Skip to content

Commit

Permalink
chore: 更新依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Jan 24, 2022
1 parent 51426d0 commit 10d8313
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
45 changes: 20 additions & 25 deletions build/vite/resolve.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
import { ResolveOptions, AliasOptions } from 'vite'
import path from 'path'
import { ResolveOptions, AliasOptions } from 'vite';
import path from 'path';

type myResolveOptions = ResolveOptions & { alias?: AliasOptions }
type myResolveOptions = ResolveOptions & { alias?: AliasOptions };

export function createViteResolve(
mode: string,
myDirname: string
): myResolveOptions {
// 解决警告You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
const I18nAlias: AliasOptions =
mode === 'development'
? { 'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js' }
: {}
const viteResolve: myResolveOptions = {
// 引用别名配置
alias: {
// 配置@别名
'@': `${path.resolve(myDirname, 'src')}`,
// 配置#别名
'#': `${path.resolve(myDirname, 'types')}`,
...I18nAlias,
},
// 导入时想要省略的扩展名列表。注意,不 建议忽略自定义导入类型的扩展名(例如:.vue),因为它会干扰 IDE 和类型支持。
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
}
export function createViteResolve(mode: string, myDirname: string): myResolveOptions {
// 解决警告You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
const I18nAlias: AliasOptions =
mode === 'development' ? { 'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js' } : {};
const viteResolve: myResolveOptions = {
// 引用别名配置
alias: {
// 配置@别名
'@': `${path.resolve(myDirname, 'src')}`,
// 配置#别名
'#': `${path.resolve(myDirname, 'types')}`,
...I18nAlias,
},
// 导入时想要省略的扩展名列表。注意,不 建议忽略自定义导入类型的扩展名(例如:.vue),因为它会干扰 IDE 和类型支持。
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
};

return viteResolve
return viteResolve;
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@logicflow/extension": "^1.0.7",
"axios": "^0.25.0",
"echarts": "^5.2.2",
"element-plus": "^1.3.0-beta.5",
"element-plus": "^1.3.0-beta.7",
"es6-promise": "^4.2.8",
"i18next": "^21.6.7",
"intro.js": "^4.3.0",
Expand Down Expand Up @@ -57,7 +57,7 @@
"@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"@vitejs/plugin-vue": "^2.0.1",
"@vitejs/plugin-vue": "^2.1.0",
"@vitejs/plugin-vue-jsx": "^1.3.3",
"@vue/compiler-sfc": "^3.2.28",
"@zougt/vite-plugin-theme-preprocessor": "^1.4.4",
Expand Down Expand Up @@ -95,7 +95,7 @@
"vite-plugin-mock": "^2.9.6",
"vite-plugin-style-import": "^1.4.1",
"vite-plugin-svg-icons": "^1.1.0",
"vue-tsc": "^0.30.6"
"vue-tsc": "^0.31.1"
},
"license": "MIT",
"config": {
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/pageLayouts/components/Sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-menu
:default-active="activeMenyu"
:unique-opened="false"
:unique-opened="true"
:collapse="appConfigMode.sidebarMode === 'horizontal' ? false : appConfigMode.collapseMenu"
:mode="mode"
>
Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createVitePlugins } from './build/vite/plugin';
import { createViteResolve } from './build/vite/resolve';
import { createViteBuild } from './build/vite/build';
import { createViteServer } from './build/vite/server';
// import { createViteOptimizeDeps } from './build/vite/optimizeDeps';
import { createViteOptimizeDeps } from './build/vite/optimizeDeps';
import { createViteCSS } from './build/vite/css';

export default (configEnv: ConfigEnv): UserConfig => {
Expand All @@ -30,7 +30,7 @@ export default (configEnv: ConfigEnv): UserConfig => {
// 打包配置
build: createViteBuild(),
// 依赖优化配置
// optimizeDeps: createViteOptimizeDeps(),
optimizeDeps: createViteOptimizeDeps(),
// css预处理配置
css: createViteCSS(),
};
Expand Down

0 comments on commit 10d8313

Please sign in to comment.