Skip to content

Commit

Permalink
style: -
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Jan 12, 2022
1 parent ac3c1d1 commit fd20ba6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion build/vite/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function createViteBuild(): BuildOptions {
// 指定生成静态资源的存放路径
assetsDir: 'static',
// 启用/禁用 CSS 代码拆分。当启用时,在异步 chunk 中导入的 CSS 将内联到异步 chunk 本身,并在块加载时插入 如果禁用,整个项目中的所有 CSS 将被提取到一个 CSS 文件中。
cssCodeSplit: false,
cssCodeSplit: true,
// 构建后是否生成 source map 文件。
sourcemap: false,
// 启用/禁用 brotli 压缩大小报告。压缩大型输出文件可能会很慢,因此禁用该功能可能会提高大型项目的构建性能。
Expand Down
80 changes: 40 additions & 40 deletions build/vite/plugin/eslinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@
* eslint
* https://bitbucket.org/unimorphic/vite-plugin-linter/src/master/
*/
import { EsLinter, linterPlugin, TypeScriptLinter } from 'vite-plugin-linter'
import type { ConfigEnv } from 'vite'
import { EsLinter, linterPlugin, TypeScriptLinter } from 'vite-plugin-linter';
import type { ConfigEnv } from 'vite';

export function configEsLinterPlugin(configEnv: ConfigEnv) {
const esLinterPlugin = linterPlugin({
// 包括检查的文件
include: [
'src/**/*.ts',
'src/**/*.d.ts',
'src/**/*.tsx',
'src/**/*.vue',
'types/**/*.d.ts',
'types/**/*.ts',
'mock/**/*.ts',
'build/**/*.ts',
'vite.config.ts',
],
//运行的lint类型(这里运行了eslint typeScriptLint)注意:目前这个插件好像还没支持styleLint没看到有相关的define
linters: [
new EsLinter({
// 环境变量
configEnv: configEnv,
// 运行时是否删除缓存文件
serveOptions: { clearCacheOnStart: true },
}),
new TypeScriptLinter(),
],
// build配置
build: {
// build配置会出现查找不到app.vue文件暂时不在build下使用
disable: true,
includeMode: 'filesInFolder',
},
// dev配置
serve: {
disable: false,
includeMode: 'processedFiles',
},
// 排除的文件
exclude: ['node_modules', 'dist', '**/*.js'],
})
return esLinterPlugin
const esLinterPlugin = linterPlugin({
// 包括检查的文件
include: [
'src/**/*.ts',
'src/**/*.d.ts',
'src/**/*.tsx',
'src/**/*.vue',
'types/**/*.d.ts',
'types/**/*.ts',
'mock/**/*.ts',
'build/**/*.ts',
'vite.config.ts',
],
//运行的lint类型(这里运行了eslint typeScriptLint)注意:目前这个插件好像还没支持styleLint没看到有相关的define
linters: [
new EsLinter({
// 环境变量
configEnv: configEnv,
// 运行时是否删除缓存文件
serveOptions: { clearCacheOnStart: true },
}),
new TypeScriptLinter(),
],
// build配置
build: {
// build配置会出现查找不到app.vue文件暂时不在build下使用
disable: true,
includeMode: 'filesInFolder',
},
// dev配置
serve: {
disable: false,
includeMode: 'processedFiles',
},
// 排除的文件
exclude: ['node_modules', 'dist', '**/*.js'],
});
return esLinterPlugin;
}
16 changes: 8 additions & 8 deletions build/vite/plugin/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
* Mock plugin for development and production.
* https://github.com/anncwb/vite-plugin-mock
*/
import { viteMockServe } from 'vite-plugin-mock'
import { viteMockServe } from 'vite-plugin-mock';

export function configMockPlugin(isBuild: boolean) {
return viteMockServe({
ignore: /^\_/,
mockPath: 'mock',
localEnabled: !isBuild,
prodEnabled: isBuild,
injectCode: `
return viteMockServe({
ignore: /^\_/,
mockPath: 'mock',
localEnabled: !isBuild,
prodEnabled: isBuild,
injectCode: `
import { setupProdMockServer } from '../mock/_createProductionServer';
setupProdMockServer();
`,
})
});
}
2 changes: 1 addition & 1 deletion build/vite/plugin/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function configStylePlugin(): Plugin | Plugin[] {
resolveStyle: (name: any) => {
name = name.slice(3);
// 使用element scss样式
return `element-plus/packages/theme-chalk/src/${name}.scss`;
return `element-plus/theme-chalk/src/${name}.scss`;
// 使用element css样式
// return `element-plus/lib/theme-chalk/${name}.css`;
},
Expand Down

0 comments on commit fd20ba6

Please sign in to comment.