diff --git a/.browserslistrc b/.browserslistrc index 214388f..9725b0f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,4 @@ > 1% last 2 versions +IE >=8 not dead diff --git a/.browserslistrc b/.browserslistrc index 214388f..9725b0f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,4 @@ > 1% last 2 versions +IE >=8 not dead diff --git a/.eslintignore b/.eslintignore index c1f31ea..e6529fc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ build/*.js -config/*.js src/assets -src/utils/dateutils.js +public +dist diff --git a/.browserslistrc b/.browserslistrc index 214388f..9725b0f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,4 @@ > 1% last 2 versions +IE >=8 not dead diff --git a/.eslintignore b/.eslintignore index c1f31ea..e6529fc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ build/*.js -config/*.js src/assets -src/utils/dateutils.js +public +dist diff --git a/.eslintrc.js b/.eslintrc.js index da83c92..d60b217 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,8 @@ env: { browser: true, node: true, - es6: true + es6: true, + jest: true }, extends: ['plugin:vue/recommended', 'eslint:recommended'], diff --git a/.browserslistrc b/.browserslistrc index 214388f..9725b0f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,4 @@ > 1% last 2 versions +IE >=8 not dead diff --git a/.eslintignore b/.eslintignore index c1f31ea..e6529fc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ build/*.js -config/*.js src/assets -src/utils/dateutils.js +public +dist diff --git a/.eslintrc.js b/.eslintrc.js index da83c92..d60b217 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,8 @@ env: { browser: true, node: true, - es6: true + es6: true, + jest: true }, extends: ['plugin:vue/recommended', 'eslint:recommended'], diff --git a/.gitignore b/.gitignore index 4ec8281..78a752d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,14 @@ .DS_Store -node_modules -/dist - -/tests/e2e/videos/ -/tests/e2e/screenshots/ - - -# local env files -.env.local -.env.*.local - -# Log files +node_modules/ +dist/ npm-debug.log* yarn-debug.log* yarn-error.log* -pnpm-debug.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log # Editor directories and files .idea @@ -23,4 +17,7 @@ *.ntvs* *.njsproj *.sln -*.sw? +*.local + +package-lock.json +yarn.lock diff --git a/.browserslistrc b/.browserslistrc index 214388f..9725b0f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,4 @@ > 1% last 2 versions +IE >=8 not dead diff --git a/.eslintignore b/.eslintignore index c1f31ea..e6529fc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ build/*.js -config/*.js src/assets -src/utils/dateutils.js +public +dist diff --git a/.eslintrc.js b/.eslintrc.js index da83c92..d60b217 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,8 @@ env: { browser: true, node: true, - es6: true + es6: true, + jest: true }, extends: ['plugin:vue/recommended', 'eslint:recommended'], diff --git a/.gitignore b/.gitignore index 4ec8281..78a752d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,14 @@ .DS_Store -node_modules -/dist - -/tests/e2e/videos/ -/tests/e2e/screenshots/ - - -# local env files -.env.local -.env.*.local - -# Log files +node_modules/ +dist/ npm-debug.log* yarn-debug.log* yarn-error.log* -pnpm-debug.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log # Editor directories and files .idea @@ -23,4 +17,7 @@ *.ntvs* *.njsproj *.sln -*.sw? +*.local + +package-lock.json +yarn.lock diff --git a/babel.config.js b/babel.config.js index e955840..fb82b27 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,14 @@ module.exports = { presets: [ + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app '@vue/cli-plugin-babel/preset' - ] + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html + 'plugins': ['dynamic-import-node'] + } + } } diff --git a/.browserslistrc b/.browserslistrc index 214388f..9725b0f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,4 @@ > 1% last 2 versions +IE >=8 not dead diff --git a/.eslintignore b/.eslintignore index c1f31ea..e6529fc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,4 @@ build/*.js -config/*.js src/assets -src/utils/dateutils.js +public +dist diff --git a/.eslintrc.js b/.eslintrc.js index da83c92..d60b217 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,8 @@ env: { browser: true, node: true, - es6: true + es6: true, + jest: true }, extends: ['plugin:vue/recommended', 'eslint:recommended'], diff --git a/.gitignore b/.gitignore index 4ec8281..78a752d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,14 @@ .DS_Store -node_modules -/dist - -/tests/e2e/videos/ -/tests/e2e/screenshots/ - - -# local env files -.env.local -.env.*.local - -# Log files +node_modules/ +dist/ npm-debug.log* yarn-debug.log* yarn-error.log* -pnpm-debug.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log # Editor directories and files .idea @@ -23,4 +17,7 @@ *.ntvs* *.njsproj *.sln -*.sw? +*.local + +package-lock.json +yarn.lock diff --git a/babel.config.js b/babel.config.js index e955840..fb82b27 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,14 @@ module.exports = { presets: [ + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app '@vue/cli-plugin-babel/preset' - ] + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html + 'plugins': ['dynamic-import-node'] + } + } } diff --git a/vue.config.js b/vue.config.js index 1607c7c..8f847d8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,6 @@ 'use strict' const path = require('path') -const defaultSettings = require('./src/settings.js') +const defaultSettings = require('./public/config/project.config') function resolve(dir) { return path.join(__dirname, dir) @@ -27,9 +27,9 @@ publicPath: './', outputDir: 'dist', assetsDir: 'static', - lintOnSave: process.env.NODE_ENV === 'development', - productionSourceMap: false, - devServer: { + lintOnSave: process.env.NODE_ENV === 'development', // set to 'default' or 'error' may cause the compilation to failed + productionSourceMap: false, // speed up production builds + devServer: { // development server config port: port, open: true, overlay: { @@ -38,6 +38,7 @@ }, before: require('./mock/mock-server.js') }, + // webpack config, if value is an object, it well be merge to final config using webpack-merge configureWebpack: { // provide the app's title in webpack's name field, so that // it can be accessed in index.html to inject the correct title. @@ -48,8 +49,9 @@ } } }, - chainWebpack(config) { - // it can improve the speed of the first screen, it is recommended to turn on preload + // A function that well receive an instance of ChanableConfig powered by webpack-chain. Allows + // for more fine-grained modification of the internal webpack config + chainWebpack: config => { // it can improve the speed of the first screen, it is recommended to turn on preload config.plugin('preload').tap(() => [ { @@ -84,6 +86,8 @@ config .when(process.env.NODE_ENV !== 'development', config => { + // runtime 代码由于只是驱动不同路由页面的关系,代码量比较少,请求 js 的时间都大于执行时间了, + // 所以使用 script-ext-html-webpack-plugin 插件将其内链在 index.html 中比较友好。 config .plugin('ScriptExtHtmlWebpackPlugin') .after('html') @@ -92,6 +96,8 @@ inline: /runtime\..*\.js$/ }]) .end() + // 如果使用了某些长期不会改变的库,像 element-ui ,打包完成有 600 多 KB , + // 包含在默认 vendor 中显然不合适,每次用户都要加载这么大的文件体验不好,所以要单独打包: config .optimization.splitChunks({ chunks: 'all',