From e98bcc026fe4b3444f2f8d5fcef8405606c17dba Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 17:38:11 +0300 Subject: [PATCH 01/46] Updated webpack template to use webpack 4 and latest versions of many packages. --- package-lock.json | 2 +- template/build/utils.js | 9 ++-- template/build/webpack.dev.conf.js | 9 ++-- template/build/webpack.prod.conf.js | 69 ++++++++++++----------------- template/build/webpack.test.conf.js | 1 + template/package.json | 59 ++++++++++++------------ 6 files changed, 70 insertions(+), 79 deletions(-) diff --git a/package-lock.json b/package-lock.json index 21209e981e..a1c2e693f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-cli-template-webpack", - "version": "1.2.8", + "version": "1.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/template/build/utils.js b/template/build/utils.js index e534fb0fd6..91bb092f88 100644 --- a/template/build/utils.js +++ b/template/build/utils.js @@ -1,7 +1,7 @@ 'use strict' const path = require('path') const config = require('../config') -const ExtractTextPlugin = require('extract-text-webpack-plugin') +const MiniCssExtractPlugin = require('mini-css-extract-plugin') const packageConfig = require('../package.json') exports.assetsPath = function (_path) { @@ -45,12 +45,9 @@ exports.cssLoaders = function (options) { // Extract CSS when that option is specified // (which is the case during production build) if (options.extract) { - return ExtractTextPlugin.extract({ - use: loaders, - fallback: 'vue-style-loader' - }) + return [MiniCssExtractPlugin.loader, ...loaders] } else { - return ['vue-style-loader'].concat(loaders) + return ['vue-style-loader', ...loaders] } } diff --git a/template/build/webpack.dev.conf.js b/template/build/webpack.dev.conf.js index 070ae221f3..4541d0b8ef 100755 --- a/template/build/webpack.dev.conf.js +++ b/template/build/webpack.dev.conf.js @@ -14,6 +14,7 @@ const HOST = process.env.HOST const PORT = process.env.PORT && Number(process.env.PORT) const devWebpackConfig = merge(baseWebpackConfig, { + mode: 'development', module: { rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) }, @@ -49,8 +50,6 @@ const devWebpackConfig = merge(baseWebpackConfig, { 'process.env': require('../config/dev.env') }), new webpack.HotModuleReplacementPlugin(), - new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. - new webpack.NoEmitOnErrorsPlugin(), // https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ filename: 'index.html', @@ -65,7 +64,11 @@ const devWebpackConfig = merge(baseWebpackConfig, { ignore: ['.*'] } ]) - ] + ], + optimization: { + namedModules: true, + noEmitOnErrors: true, + }, }) module.exports = new Promise((resolve, reject) => { diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index fc5d53fa3d..69378a001e 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -7,7 +7,7 @@ const merge = require('webpack-merge') const baseWebpackConfig = require('./webpack.base.conf') const CopyWebpackPlugin = require('copy-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') -const ExtractTextPlugin = require('extract-text-webpack-plugin') +const MiniCssExtractPlugin = require('mini-css-extract-plugin') const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') const UglifyJsPlugin = require('uglifyjs-webpack-plugin') @@ -16,6 +16,7 @@ const env = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing' : {{/if_or}}require('../config/prod.env') const webpackConfig = merge(baseWebpackConfig, { + mode: 'production', module: { rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, @@ -44,13 +45,8 @@ const webpackConfig = merge(baseWebpackConfig, { parallel: true }), // extract css into its own file - new ExtractTextPlugin({ + new MiniCssExtractPlugin({ filename: utils.assetsPath('css/[name].[contenthash].css'), - // Setting the following option to `false` will not extract CSS from codesplit chunks. - // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. - // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, - // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 - allChunks: true, }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. @@ -80,38 +76,6 @@ const webpackConfig = merge(baseWebpackConfig, { }), // keep module.id stable when vendor modules does not change new webpack.HashedModuleIdsPlugin(), - // enable scope hoisting - new webpack.optimize.ModuleConcatenationPlugin(), - // split vendor js into its own file - new webpack.optimize.CommonsChunkPlugin({ - name: 'vendor', - minChunks (module) { - // any required modules inside node_modules are extracted to vendor - return ( - module.resource && - /\.js$/.test(module.resource) && - module.resource.indexOf( - path.join(__dirname, '../node_modules') - ) === 0 - ) - } - }), - // extract webpack runtime and module manifest to its own file in order to - // prevent vendor hash from being updated whenever app bundle is updated - new webpack.optimize.CommonsChunkPlugin({ - name: 'manifest', - minChunks: Infinity - }), - // This instance extracts shared chunks from code splitted chunks and bundles them - // in a separate chunk, similar to the vendor chunk - // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk - new webpack.optimize.CommonsChunkPlugin({ - name: 'app', - async: 'vendor-async', - children: true, - minChunks: 3 - }), - // copy custom static assets new CopyWebpackPlugin([ { @@ -120,7 +84,32 @@ const webpackConfig = merge(baseWebpackConfig, { ignore: ['.*'] } ]) - ] + ], + optimization: { + concatenateModules: true, + splitChunks: { + cacheGroups: { + vendor: { + // split vendor js into its own file + name: 'vendor', + }, + manifest: { + // extract webpack runtime and module manifest to its own file in order to + // prevent vendor hash from being updated whenever app bundle is updated + name: 'manifest', + minChunks: Infinity + }, + app: { + // This instance extracts shared chunks from code splitted chunks and bundles them + // in a separate chunk, similar to the vendor chunk + // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk + name: 'app', + chunks: 'async', + minChunks: 3 + }, + }, + }, + }, }) if (config.build.productionGzip) { diff --git a/template/build/webpack.test.conf.js b/template/build/webpack.test.conf.js index 0d658d9ebe..9ad270f3b7 100644 --- a/template/build/webpack.test.conf.js +++ b/template/build/webpack.test.conf.js @@ -7,6 +7,7 @@ const merge = require('webpack-merge') const baseWebpackConfig = require('./webpack.base.conf') const webpackConfig = merge(baseWebpackConfig, { + mode: 'development', // use inline sourcemap for karma-sourcemap-loader module: { rules: utils.styleLoaders() diff --git a/template/package.json b/template/package.json index 207322b98c..ee0f6b6119 100644 --- a/template/package.json +++ b/template/package.json @@ -25,22 +25,22 @@ "build": "node build/build.js" }, "dependencies": { - "vue": "^2.5.2"{{#router}}, + "vue": "^2.5.16"{{#router}}, "vue-router": "^3.0.1"{{/router}} }, "devDependencies": { {{#lint}} - "babel-eslint": "^7.2.3", + "babel-eslint": "^8.2.1", "eslint": "^4.15.0", - "eslint-friendly-formatter": "^3.0.0", - "eslint-loader": "^1.7.1", + "eslint-friendly-formatter": "^4.0.1", + "eslint-loader": "^2.0.0", "eslint-plugin-vue": "^4.0.0", {{#if_eq lintConfig "standard"}} - "eslint-config-standard": "^10.2.1", + "eslint-config-standard": "^11.0.0", "eslint-plugin-promise": "^3.4.0", - "eslint-plugin-standard": "^3.0.1", + "eslint-plugin-standard": "^3.1.0", "eslint-plugin-import": "^2.7.0", - "eslint-plugin-node": "^5.2.0", + "eslint-plugin-node": "^6.0.1", {{/if_eq}} {{#if_eq lintConfig "airbnb"}} "eslint-config-airbnb-base": "^11.3.0", @@ -58,32 +58,32 @@ {{/if_eq}} {{#if_eq runner "karma"}} "cross-env": "^5.0.1", - "karma": "^1.4.1", + "karma": "^2.0.2", "karma-coverage": "^1.1.1", "karma-mocha": "^1.3.0", "karma-phantomjs-launcher": "^1.0.2", "karma-phantomjs-shim": "^1.4.0", "karma-sinon-chai": "^1.3.1", "karma-sourcemap-loader": "^0.3.7", - "karma-spec-reporter": "0.0.31", - "karma-webpack": "^2.0.2", - "mocha": "^3.2.0", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "^3.0.0", + "mocha": "^5.1.1", "chai": "^4.1.2", "sinon": "^4.0.0", - "sinon-chai": "^2.8.0", - "inject-loader": "^3.0.0", + "sinon-chai": "^3.0.0", + "inject-loader": "^4.0.1", "babel-plugin-istanbul": "^4.1.1", "phantomjs-prebuilt": "^2.1.14", {{/if_eq}} {{#e2e}} "babel-register": "^6.22.0", - "chromedriver": "^2.27.2", - "cross-spawn": "^5.0.1", - "nightwatch": "^0.9.12", + "chromedriver": "^2.38.2", + "cross-spawn": "^6.0.5", + "nightwatch": "^0.9.21", "selenium-server": "^3.0.1", {{/e2e}} - "autoprefixer": "^7.1.2", - "babel-core": "^6.22.1", + "autoprefixer": "^8.3.0", + "babel-core": "^6.26.3", "babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-loader": "^7.1.1", "babel-plugin-syntax-jsx": "^6.18.0", @@ -91,31 +91,32 @@ "babel-plugin-transform-vue-jsx": "^3.5.0", "babel-preset-env": "^1.3.2", "babel-preset-stage-2": "^6.22.0", - "chalk": "^2.0.1", + "chalk": "^2.4.1", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.28.0", - "extract-text-webpack-plugin": "^3.0.0", + "mini-css-extract-plugin": "^0.4.0", "file-loader": "^1.1.4", "friendly-errors-webpack-plugin": "^1.6.1", - "html-webpack-plugin": "^2.30.1", + "html-webpack-plugin": "^3.2.0", "webpack-bundle-analyzer": "^2.9.0", "node-notifier": "^5.1.2", "postcss-import": "^11.0.0", "postcss-loader": "^2.0.8", "postcss-url": "^7.2.1", "semver": "^5.3.0", - "shelljs": "^0.7.6", - "optimize-css-assets-webpack-plugin": "^3.2.0", - "ora": "^1.2.0", + "shelljs": "^0.8.1", + "optimize-css-assets-webpack-plugin": "^4.0.0", + "ora": "^2.0.0", "rimraf": "^2.6.0", "uglifyjs-webpack-plugin": "^1.1.1", - "url-loader": "^0.5.8", - "vue-loader": "^13.3.0", - "vue-style-loader": "^3.0.1", + "url-loader": "^1.0.1", + "vue-loader": "^14.2.2", + "vue-style-loader": "^4.1.0", "vue-template-compiler": "^2.5.2", "portfinder": "^1.0.13", - "webpack": "^3.6.0", - "webpack-dev-server": "^2.9.1", + "webpack": "^4.6.0", + "webpack-cli": "^2.0.15", + "webpack-dev-server": "^3.1.3", "webpack-merge": "^4.1.0" }, "engines": { From 6bba5e45efa425acc14d0dc2fa01dca3640c3bb6 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 19:13:40 +0300 Subject: [PATCH 02/46] Restored chunking in webpack 4 based on config for webpack 3. --- template/build/webpack.prod.conf.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 69378a001e..51ba683d1e 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -92,17 +92,12 @@ const webpackConfig = merge(baseWebpackConfig, { vendor: { // split vendor js into its own file name: 'vendor', - }, - manifest: { - // extract webpack runtime and module manifest to its own file in order to - // prevent vendor hash from being updated whenever app bundle is updated - name: 'manifest', - minChunks: Infinity + test: new RegExp(`${path.join(__dirname, '../node_modules')}.*\.js$`), + enforce: true, + chunks: 'initial', }, app: { - // This instance extracts shared chunks from code splitted chunks and bundles them - // in a separate chunk, similar to the vendor chunk - // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk + // create chunks for the app itself name: 'app', chunks: 'async', minChunks: 3 From 709b528c755c62b1d13af1070c31a714420d8aef Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 19:14:47 +0300 Subject: [PATCH 03/46] Added [name] to chunk filename for readability. --- template/build/webpack.prod.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 51ba683d1e..211cc4b4f5 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -28,7 +28,7 @@ const webpackConfig = merge(baseWebpackConfig, { output: { path: config.build.assetsRoot, filename: utils.assetsPath('js/[name].[chunkhash].js'), - chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') + chunkFilename: utils.assetsPath('js/[name].[chunkhash].js') }, plugins: [ // http://vuejs.github.io/vue-loader/en/workflow/production.html From 1c7856afc0ce1c874077487e89f5cfb03e0eba94 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 20:09:06 +0300 Subject: [PATCH 04/46] Fixed incorrect path regex. --- template/build/webpack.prod.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 211cc4b4f5..901c538463 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -92,7 +92,7 @@ const webpackConfig = merge(baseWebpackConfig, { vendor: { // split vendor js into its own file name: 'vendor', - test: new RegExp(`${path.join(__dirname, '../node_modules')}.*\.js$`), + test: /[\\/]node_modules[\\/].*\.js$/, enforce: true, chunks: 'initial', }, From 00aae83577a08c38edcb2513d18284fb2176b51c Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 20:10:19 +0300 Subject: [PATCH 05/46] Added runtime chunk (replaces manifest chunk). --- template/build/webpack.prod.conf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 901c538463..948c7216bb 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -104,6 +104,7 @@ const webpackConfig = merge(baseWebpackConfig, { }, }, }, + runtimeChunk: 'single', }, }) From edd85ff5f0920cadb1dca38a67fd26cee07459bd Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 20:10:57 +0300 Subject: [PATCH 06/46] Merged some recommended chunking settings based on webpack 4 defaults. --- template/build/webpack.prod.conf.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 948c7216bb..10e596eaa6 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -88,19 +88,20 @@ const webpackConfig = merge(baseWebpackConfig, { optimization: { concatenateModules: true, splitChunks: { + chunks: 'async', cacheGroups: { vendor: { - // split vendor js into its own file name: 'vendor', test: /[\\/]node_modules[\\/].*\.js$/, enforce: true, chunks: 'initial', + priority: -10, }, app: { - // create chunks for the app itself name: 'app', - chunks: 'async', - minChunks: 3 + minChunks: 3, + priority: -20, + reuseExistingChunk: true, }, }, }, From 27481de291ffae798cce6c690c099689b26649c6 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 20:12:04 +0300 Subject: [PATCH 07/46] Removed "enforce" property. Doesn't seem to do anything useful. --- template/build/webpack.prod.conf.js | 1 - 1 file changed, 1 deletion(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 10e596eaa6..67b803e6c4 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -93,7 +93,6 @@ const webpackConfig = merge(baseWebpackConfig, { vendor: { name: 'vendor', test: /[\\/]node_modules[\\/].*\.js$/, - enforce: true, chunks: 'initial', priority: -10, }, From f6f9cd972221ce704d7b3dc8c39a00650a9fff55 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 20:20:51 +0300 Subject: [PATCH 08/46] Moved uglifyjs plugin to new optimization.minimizer config property. --- template/build/webpack.prod.conf.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 67b803e6c4..b7a89cc64b 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -35,15 +35,6 @@ const webpackConfig = merge(baseWebpackConfig, { new webpack.DefinePlugin({ 'process.env': env }), - new UglifyJsPlugin({ - uglifyOptions: { - compress: { - warnings: false - } - }, - sourceMap: config.build.productionSourceMap, - parallel: true - }), // extract css into its own file new MiniCssExtractPlugin({ filename: utils.assetsPath('css/[name].[contenthash].css'), @@ -105,6 +96,17 @@ const webpackConfig = merge(baseWebpackConfig, { }, }, runtimeChunk: 'single', + minimizer: [ + new UglifyJsPlugin({ + uglifyOptions: { + compress: { + warnings: false + } + }, + sourceMap: config.build.productionSourceMap, + parallel: true + }), + ], }, }) From c699f009b65e44321b32cb1da54a69dee6d89962 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Fri, 27 Apr 2018 21:49:06 +0300 Subject: [PATCH 09/46] Updated vue-loader to 15. Also refactored generateLoaders for clarity. --- template/build/utils.js | 25 +++++++++++++++++-------- template/build/vue-loader.conf.js | 12 +----------- template/build/webpack.base.conf.js | 4 ++++ template/package.json | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/template/build/utils.js b/template/build/utils.js index 91bb092f88..2d640e24f9 100644 --- a/template/build/utils.js +++ b/template/build/utils.js @@ -31,7 +31,22 @@ exports.cssLoaders = function (options) { // generate loader string to be used with extract text plugin function generateLoaders (loader, loaderOptions) { - const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] + const loaders = [] + + // Extract CSS when that option is specified + // (which is the case during production build) + if (options.extract) { + loaders.push(MiniCssExtractPlugin.loader) + } + else { + loaders.push('vue-style-loader') + } + + loaders.push(cssLoader) + + if (options.usePostCSS) { + loaders.push(postcssLoader) + } if (loader) { loaders.push({ @@ -42,13 +57,7 @@ exports.cssLoaders = function (options) { }) } - // Extract CSS when that option is specified - // (which is the case during production build) - if (options.extract) { - return [MiniCssExtractPlugin.loader, ...loaders] - } else { - return ['vue-style-loader', ...loaders] - } + return loaders } // https://vue-loader.vuejs.org/en/configurations/extract-css.html diff --git a/template/build/vue-loader.conf.js b/template/build/vue-loader.conf.js index 33ed58bc0a..1231f46329 100644 --- a/template/build/vue-loader.conf.js +++ b/template/build/vue-loader.conf.js @@ -1,19 +1,9 @@ 'use strict' -const utils = require('./utils') const config = require('../config') -const isProduction = process.env.NODE_ENV === 'production' -const sourceMapEnabled = isProduction - ? config.build.productionSourceMap - : config.dev.cssSourceMap module.exports = { - loaders: utils.cssLoaders({ - sourceMap: sourceMapEnabled, - extract: isProduction - }), - cssSourceMap: sourceMapEnabled, cacheBusting: config.dev.cacheBusting, - transformToRequire: { + transformAssetUrls: { video: ['src', 'poster'], source: 'src', img: 'src', diff --git a/template/build/webpack.base.conf.js b/template/build/webpack.base.conf.js index 391160c571..f53fc6adf2 100644 --- a/template/build/webpack.base.conf.js +++ b/template/build/webpack.base.conf.js @@ -3,6 +3,7 @@ const path = require('path') const utils = require('./utils') const config = require('../config') const vueLoaderConfig = require('./vue-loader.conf') +const { VueLoaderPlugin } = require('vue-loader') function resolve (dir) { return path.join(__dirname, '..', dir) @@ -31,6 +32,9 @@ module.exports = { ? config.build.assetsPublicPath : config.dev.assetsPublicPath }, + plugins: [ + new VueLoaderPlugin(), + ], resolve: { extensions: ['.js', '.vue', '.json'], alias: { diff --git a/template/package.json b/template/package.json index ee0f6b6119..da64768975 100644 --- a/template/package.json +++ b/template/package.json @@ -110,7 +110,7 @@ "rimraf": "^2.6.0", "uglifyjs-webpack-plugin": "^1.1.1", "url-loader": "^1.0.1", - "vue-loader": "^14.2.2", + "vue-loader": "^15.0.3", "vue-style-loader": "^4.1.0", "vue-template-compiler": "^2.5.2", "portfinder": "^1.0.13", From 8d638f077465367460421b6b6b5f9fc17f78b4c6 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 28 Apr 2018 12:54:15 +0300 Subject: [PATCH 10/46] Updated nightwatch to 1.0.3 beta. Attempt to fix failing build. --- template/package.json | 5 +- template/test/e2e/nightwatch.conf.js | 76 +++++++++++++++++++++------- template/test/e2e/specs/test.js | 3 +- 3 files changed, 63 insertions(+), 21 deletions(-) diff --git a/template/package.json b/template/package.json index da64768975..767d452d2d 100644 --- a/template/package.json +++ b/template/package.json @@ -78,9 +78,10 @@ {{#e2e}} "babel-register": "^6.22.0", "chromedriver": "^2.38.2", + "geckodriver": "^1.11.0", "cross-spawn": "^6.0.5", - "nightwatch": "^0.9.21", - "selenium-server": "^3.0.1", + "nightwatch": "^1.0.3", + "selenium-server": "^3.11.0", {{/e2e}} "autoprefixer": "^8.3.0", "babel-core": "^6.26.3", diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index f019c0ac44..ec82c929ca 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -1,45 +1,87 @@ require('babel-register') var config = require('../../config') +const paths = { + chromedriver: require('chromedriver').path, + geckodriver: require('geckodriver').path, + seleniumServer: require('selenium-server').path, + launchUrl: 'http://localhost:' + (process.env.PORT || config.dev.port) +} +console.log('paths:', paths) // http://nightwatchjs.org/gettingstarted#settings-file module.exports = { src_folders: ['test/e2e/specs'], output_folder: 'test/e2e/reports', custom_assertions_path: ['test/e2e/custom-assertions'], + detailed_output: true, + silent: false, + launch_url: paths.launchUrl, + filter: '*.js', - selenium: { + webdriver: { start_process: true, - server_path: require('selenium-server').path, - host: '127.0.0.1', - port: 4444, - cli_args: { - 'webdriver.chrome.driver': require('chromedriver').path - } + server_path: paths.seleniumServer, + host: 'localhost', + port: 4444 }, test_settings: { - default: { - selenium_port: 4444, - selenium_host: 'localhost', - silent: true, - globals: { - devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) - } - }, + // selenium_server: { + // start_session: true, + // selenium: { + // start_process: true, + // host: 'localhost', + // port: 4444, + // server_path: paths.seleniumServer, + // silent: true, + // cli_args: { + // 'webdriver.chrome.driver': paths.chromedriver, + // 'webdriver.gecko.driver': paths.geckodriver, + // 'webdriver.firefox.profile': '' + // }, + // desiredCapabilities: { + // browserName: 'chrome' + // } + // } + // }, chrome: { + start_session: true, + webdriver: { + start_process: true, + server_path: paths.chromedriver, + port: 9515, + cli_args: [ + '--verbose' + ] + }, desiredCapabilities: { browserName: 'chrome', javascriptEnabled: true, - acceptSslCerts: true + acceptSslCerts: true, + loggingPrefs: { + driver: 'INFO', + server: 'OFF', + browser: 'INFO' + } } }, firefox: { + start_session: true, + webdriver: { + start_process: true, + server_path: paths.geckodriver, + cli_args: [ + '--log', 'debug' + ] + }, desiredCapabilities: { browserName: 'firefox', javascriptEnabled: true, - acceptSslCerts: true + acceptSslCerts: true, + acceptInsecureCerts: true, + marionette: true } } } diff --git a/template/test/e2e/specs/test.js b/template/test/e2e/specs/test.js index 92ecc1216d..2992a56c42 100644 --- a/template/test/e2e/specs/test.js +++ b/template/test/e2e/specs/test.js @@ -6,10 +6,9 @@ module.exports = { // automatically uses dev Server port from /config.index.js // default: http://localhost:8080 // see nightwatch.conf.js - const devServer = browser.globals.devServerURL browser - .url(devServer) + .url(browser.launch_url) .waitForElementVisible('#app', 5000) .assert.elementPresent('.hello') .assert.containsText('h1', 'Welcome to Your Vue.js App') From 3ebf10bac7fd02565d27f4a4c328cd236f4efc69 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 28 Apr 2018 15:14:10 +0300 Subject: [PATCH 11/46] Testing a docker image that doesn't install the chromedriver globally. --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5186160e0..7d67433af1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,8 @@ version: 2 vm_settings: &vm_settings docker: - - image: circleci/node:6.12.3-browsers +# - image: circleci/node:6.12.3-browsers + - image: https://raw.githubusercontent.com/noamkfir/circleci-dockerfiles/master/node/images/6.12.3/browsers/Dockerfile jobs: install_template_deps: From 00d5aa364d82961663073e05834447cd6087504e Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 28 Apr 2018 15:21:17 +0300 Subject: [PATCH 12/46] Another try. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d67433af1..6d6422cf8c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 vm_settings: &vm_settings docker: # - image: circleci/node:6.12.3-browsers - - image: https://raw.githubusercontent.com/noamkfir/circleci-dockerfiles/master/node/images/6.12.3/browsers/Dockerfile + - image: github.com/noamkfir/circleci-dockerfiles#:node/images/6.12.3/browsers jobs: install_template_deps: From b2c278555f8451b4e0c41ad4ea5f668b6dbb534f Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 28 Apr 2018 15:47:00 +0300 Subject: [PATCH 13/46] And another one. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d6422cf8c..70f58f3fa8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 vm_settings: &vm_settings docker: # - image: circleci/node:6.12.3-browsers - - image: github.com/noamkfir/circleci-dockerfiles#:node/images/6.12.3/browsers + - image: github.com/noamkfir/circleci-dockerfiles#master:node/images/6.12.3/browsers jobs: install_template_deps: From 2056ba632f149b678e588b5307a4b2dbd5c4a919 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 28 Apr 2018 15:51:14 +0300 Subject: [PATCH 14/46] Last try before we die. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 70f58f3fa8..c4c37f37af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 vm_settings: &vm_settings docker: # - image: circleci/node:6.12.3-browsers - - image: github.com/noamkfir/circleci-dockerfiles#master:node/images/6.12.3/browsers + - image: github.com/noamkfir/circleci-dockerfiles/node:6.12.3-browsers jobs: install_template_deps: From 0783d37589ca5527c9bc760bb6417fdf61a161fa Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sun, 29 Apr 2018 09:54:21 +0300 Subject: [PATCH 15/46] Attempt to build using a custom CircleCI docker image. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c4c37f37af..beafa870d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 vm_settings: &vm_settings docker: # - image: circleci/node:6.12.3-browsers - - image: github.com/noamkfir/circleci-dockerfiles/node:6.12.3-browsers + - image: boundlesscode/node:6.12.3-browsers-sans-drivers jobs: install_template_deps: From 3fc49654175d7cb0786f04e94f01686e42cdc4b6 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Tue, 1 May 2018 12:39:52 +0300 Subject: [PATCH 16/46] Adding artifacts to failing builds. --- .circleci/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index beafa870d5..ea0d33c204 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,6 +87,10 @@ jobs: name: Test build command: npm run build when: always + - store_artifacts: + path: ~/project/webpack-template/test-full/*.log + - store_artifacts: + path: ~/project/webpack-template/test-full/tests_output scenario_full-karma-airbnb: <<: *vm_settings @@ -120,6 +124,10 @@ jobs: name: Test build command: npm run build when: always + - store_artifacts: + path: ~/project/webpack-template/test-full-karma/*.log + - store_artifacts: + path: ~/project/webpack-template/test-full-karma-airbnb/tests_output workflows: From e6cc3f268e3a4462613fc233ecbfc4b1e887b8fb Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 13:17:30 +0300 Subject: [PATCH 17/46] Created logs folder, set nightwatch to store webdriver logs there, and circleci to collect them from there. --- .circleci/config.yml | 4 ++-- template/logs/.gitignore | 2 ++ template/test/e2e/nightwatch.conf.js | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 template/logs/.gitignore diff --git a/.circleci/config.yml b/.circleci/config.yml index ea0d33c204..bd596efa00 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: command: npm run build when: always - store_artifacts: - path: ~/project/webpack-template/test-full/*.log + path: ~/project/webpack-template/test-full/logs - store_artifacts: path: ~/project/webpack-template/test-full/tests_output @@ -125,7 +125,7 @@ jobs: command: npm run build when: always - store_artifacts: - path: ~/project/webpack-template/test-full-karma/*.log + path: ~/project/webpack-template/test-full-karma/logs - store_artifacts: path: ~/project/webpack-template/test-full-karma-airbnb/tests_output diff --git a/template/logs/.gitignore b/template/logs/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/template/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index ec82c929ca..55ed28cacf 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -5,9 +5,11 @@ const paths = { chromedriver: require('chromedriver').path, geckodriver: require('geckodriver').path, seleniumServer: require('selenium-server').path, - launchUrl: 'http://localhost:' + (process.env.PORT || config.dev.port) + launchUrl: 'http://localhost:' + (process.env.PORT || config.dev.port), + logPath: 'logs', } console.log('paths:', paths) + // http://nightwatchjs.org/gettingstarted#settings-file module.exports = { src_folders: ['test/e2e/specs'], @@ -21,6 +23,7 @@ module.exports = { webdriver: { start_process: true, server_path: paths.seleniumServer, + log_path: paths.logPath, host: 'localhost', port: 4444 }, From 63f95b34a979b5d6323ab53ed470c5ce36213d24 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 13:17:49 +0300 Subject: [PATCH 18/46] Removed chromedriver start_process instruction. --- template/test/e2e/nightwatch.conf.js | 1 - 1 file changed, 1 deletion(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index 55ed28cacf..fbdaa5be38 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -21,7 +21,6 @@ module.exports = { filter: '*.js', webdriver: { - start_process: true, server_path: paths.seleniumServer, log_path: paths.logPath, host: 'localhost', From df5dadf81af64e046368c80152243fd181714ef9 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 13:18:14 +0300 Subject: [PATCH 19/46] Added server info to the chromedriver logging preferences. --- template/test/e2e/nightwatch.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index fbdaa5be38..29a9e9c231 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -63,7 +63,7 @@ module.exports = { acceptSslCerts: true, loggingPrefs: { driver: 'INFO', - server: 'OFF', + server: 'INFO', browser: 'INFO' } } From d731f25a40582958630c4e68948baa02fc60ba65 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 17:53:22 +0300 Subject: [PATCH 20/46] Fixed log path for test-full-karma-airbnb in circleci config.yml. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd596efa00..b29b77a893 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,7 +125,7 @@ jobs: command: npm run build when: always - store_artifacts: - path: ~/project/webpack-template/test-full-karma/logs + path: ~/project/webpack-template/test-full-karma-airbnb/logs - store_artifacts: path: ~/project/webpack-template/test-full-karma-airbnb/tests_output From 597f74a4461a7786ac6f36781f8a61f4c4a59caf Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 17:54:29 +0300 Subject: [PATCH 21/46] Removed 'server' logging unsupported by chromedriver. --- template/test/e2e/nightwatch.conf.js | 1 - 1 file changed, 1 deletion(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index 29a9e9c231..d3ab3642be 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -63,7 +63,6 @@ module.exports = { acceptSslCerts: true, loggingPrefs: { driver: 'INFO', - server: 'INFO', browser: 'INFO' } } From cee65fda1166578630168cfc028181773bedaf9e Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 18:21:06 +0300 Subject: [PATCH 22/46] Testing debian 9 (stretch) image. --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b29b77a893..ab6d6cfdd1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,7 @@ version: 2 vm_settings: &vm_settings docker: -# - image: circleci/node:6.12.3-browsers - - image: boundlesscode/node:6.12.3-browsers-sans-drivers + - image: circleci/node:6.12.3-stretch-browsers jobs: install_template_deps: From 6162c84c4c631f2a6d316292e4fad6cf7a8df6c2 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 18:34:56 +0300 Subject: [PATCH 23/46] Testing node 6.14.1 on debian 9 (stretch) browsers image. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab6d6cfdd1..f0370621ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 vm_settings: &vm_settings docker: - - image: circleci/node:6.12.3-stretch-browsers + - image: circleci/node:6.14.1-stretch-browsers jobs: install_template_deps: From cd325ef182698cfde0ce154f427e3ffe194c4753 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 20:20:49 +0300 Subject: [PATCH 24/46] Trying node 6.14.1 with debian 9 (stretch) and browsers, but no drivers. --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f0370621ed..e374712b1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,8 @@ version: 2 vm_settings: &vm_settings docker: - - image: circleci/node:6.14.1-stretch-browsers + # - image: circleci/node:6.14.1-stretch-browsers + - image: boundlesscode/node:6.14.1-stretch-browsers-sans-drivers jobs: install_template_deps: From c503037dc1b16066b8a079810a4c1c7d4a2eca21 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 21:15:43 +0300 Subject: [PATCH 25/46] Added headless arg for chrome browser. --- template/test/e2e/nightwatch.conf.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index d3ab3642be..52502a52a3 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -64,7 +64,12 @@ module.exports = { loggingPrefs: { driver: 'INFO', browser: 'INFO' - } + }, + chromeOptions: { + args: [ + '--headless', + ], + }, } }, From 7ed7f28e23f0742e97a29c6181cf09dd13d3a8e4 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 21:32:17 +0300 Subject: [PATCH 26/46] Back to circleci 6.12.3-browsers image. --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e374712b1c..93f98ae545 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,7 @@ version: 2 vm_settings: &vm_settings docker: - # - image: circleci/node:6.14.1-stretch-browsers - - image: boundlesscode/node:6.14.1-stretch-browsers-sans-drivers + - image: circleci/node:6.12.3-browsers jobs: install_template_deps: From 6d13e1e0c120f5633c7a02b095b870010ace7452 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 21:39:33 +0300 Subject: [PATCH 27/46] Trying circleci/node:6.14.1-browsers again. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 93f98ae545..6115686bf3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 vm_settings: &vm_settings docker: - - image: circleci/node:6.12.3-browsers + - image: circleci/node:6.14.1-browsers jobs: install_template_deps: From 2d136610c8f94412b7c7310983fac51bd8b0de60 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 2 May 2018 21:48:18 +0300 Subject: [PATCH 28/46] Restoring generated image with LATEST chrome instead of CircleCI's v64. --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6115686bf3..b34e37867f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,8 @@ version: 2 vm_settings: &vm_settings docker: - - image: circleci/node:6.14.1-browsers + # - image: circleci/node:6.14.1-browsers + - image: boundlesscode/node:6.14.1-stretch-browsers-sans-drivers jobs: install_template_deps: From 0db5de09bfaaaf0a3faa1994a80fb67f2dcaaa1b Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 16:30:30 +0300 Subject: [PATCH 29/46] Unified webpack output filename templates for js and css files, based on [chunkhash]. --- template/build/webpack.prod.conf.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index b7a89cc64b..76c6c4b381 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -28,7 +28,6 @@ const webpackConfig = merge(baseWebpackConfig, { output: { path: config.build.assetsRoot, filename: utils.assetsPath('js/[name].[chunkhash].js'), - chunkFilename: utils.assetsPath('js/[name].[chunkhash].js') }, plugins: [ // http://vuejs.github.io/vue-loader/en/workflow/production.html @@ -37,7 +36,7 @@ const webpackConfig = merge(baseWebpackConfig, { }), // extract css into its own file new MiniCssExtractPlugin({ - filename: utils.assetsPath('css/[name].[contenthash].css'), + filename: utils.assetsPath('css/[name].[chunkhash].css'), }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. From 052a757ba2141d1b826465b6076efc5a9eb0126c Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 16:32:08 +0300 Subject: [PATCH 30/46] Removed obsolete reference to CommonsChunkPlugin in comment. --- template/build/webpack.prod.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 76c6c4b381..6b780e6570 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -61,7 +61,7 @@ const webpackConfig = merge(baseWebpackConfig, { // more options: // https://github.com/kangax/html-minifier#options-quick-reference }, - // necessary to consistently work with multiple chunks via CommonsChunkPlugin + // necessary to consistently work with multiple chunks chunksSortMode: 'dependency' }), // keep module.id stable when vendor modules does not change From b7a10c12855d98726861f973020b2e010758fdcb Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 16:43:46 +0300 Subject: [PATCH 31/46] Optimize both statically and dynamically imported chunks per webpack recommendations and to help stabilize chunk hashes. --- template/build/webpack.prod.conf.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 6b780e6570..45905498ff 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -78,12 +78,11 @@ const webpackConfig = merge(baseWebpackConfig, { optimization: { concatenateModules: true, splitChunks: { - chunks: 'async', + chunks: 'all', cacheGroups: { vendor: { name: 'vendor', test: /[\\/]node_modules[\\/].*\.js$/, - chunks: 'initial', priority: -10, }, app: { From aac5cc07d0d9d14df88c896f681fa59a6a8014f4 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 16:57:13 +0300 Subject: [PATCH 32/46] Force creation of vendor chunk and restore default webpack 4 prioritization for other chunks. --- template/build/webpack.prod.conf.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 45905498ff..49365c8bb5 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -83,12 +83,11 @@ const webpackConfig = merge(baseWebpackConfig, { vendor: { name: 'vendor', test: /[\\/]node_modules[\\/].*\.js$/, - priority: -10, + enforce: true, }, app: { name: 'app', minChunks: 3, - priority: -20, reuseExistingChunk: true, }, }, From 3aa7005a5671b9d422b1bd383051530f4c868f01 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 17:01:13 +0300 Subject: [PATCH 33/46] Changed vendor chunk test to match *any* node_modules files, not just .js files. --- template/build/webpack.prod.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 49365c8bb5..5b705d6f18 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -82,7 +82,7 @@ const webpackConfig = merge(baseWebpackConfig, { cacheGroups: { vendor: { name: 'vendor', - test: /[\\/]node_modules[\\/].*\.js$/, + test: /[\\/]node_modules[\\/]/, enforce: true, }, app: { From 882d31681f0ee6b83b6ab4ce79b9a910dd0b0504 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 17:36:28 +0300 Subject: [PATCH 34/46] Removed explicit "app" chunk in favor of default webpack configuration that creates chunks based on "entry" properties. --- template/build/webpack.prod.conf.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 5b705d6f18..841c8ea9eb 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -85,11 +85,6 @@ const webpackConfig = merge(baseWebpackConfig, { test: /[\\/]node_modules[\\/]/, enforce: true, }, - app: { - name: 'app', - minChunks: 3, - reuseExistingChunk: true, - }, }, }, runtimeChunk: 'single', From 7fe7b3ccecdccbe39378fa33fe3e2b73792d9da6 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Sat, 19 May 2018 17:40:06 +0300 Subject: [PATCH 35/46] Added NamedChunksPlugin before HashedModuleIdsPlugin to stabilize chunk hashes. --- template/build/webpack.prod.conf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 841c8ea9eb..e1cf392389 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -65,6 +65,7 @@ const webpackConfig = merge(baseWebpackConfig, { chunksSortMode: 'dependency' }), // keep module.id stable when vendor modules does not change + new webpack.NamedChunksPlugin(), new webpack.HashedModuleIdsPlugin(), // copy custom static assets new CopyWebpackPlugin([ From 360404060bbe9d9cd86ad64192e04a87a6fb7dae Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 23 May 2018 15:11:44 +0300 Subject: [PATCH 36/46] Cleaned up nightwatch.conf.js a bit. --- template/test/e2e/nightwatch.conf.js | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index 52502a52a3..9ba4ea8b9e 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -1,5 +1,5 @@ require('babel-register') -var config = require('../../config') +const config = require('../../config') const paths = { chromedriver: require('chromedriver').path, @@ -28,25 +28,6 @@ module.exports = { }, test_settings: { - // selenium_server: { - // start_session: true, - // selenium: { - // start_process: true, - // host: 'localhost', - // port: 4444, - // server_path: paths.seleniumServer, - // silent: true, - // cli_args: { - // 'webdriver.chrome.driver': paths.chromedriver, - // 'webdriver.gecko.driver': paths.geckodriver, - // 'webdriver.firefox.profile': '' - // }, - // desiredCapabilities: { - // browserName: 'chrome' - // } - // } - // }, - chrome: { start_session: true, webdriver: { @@ -72,7 +53,6 @@ module.exports = { }, } }, - firefox: { start_session: true, webdriver: { From ad1999d6669410853d5029f4b313c80c0a6cec32 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Wed, 23 May 2018 15:16:27 +0300 Subject: [PATCH 37/46] Added debugTests constant (defaulting to false) to nightwatch.conf.js. --- template/test/e2e/nightwatch.conf.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index 9ba4ea8b9e..5768c3e4fb 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -8,7 +8,12 @@ const paths = { launchUrl: 'http://localhost:' + (process.env.PORT || config.dev.port), logPath: 'logs', } -console.log('paths:', paths) + +const debugTests = false + +if (debugTests) { + console.log('paths:', paths) +} // http://nightwatchjs.org/gettingstarted#settings-file module.exports = { @@ -16,7 +21,7 @@ module.exports = { output_folder: 'test/e2e/reports', custom_assertions_path: ['test/e2e/custom-assertions'], detailed_output: true, - silent: false, + silent: !debugTests, launch_url: paths.launchUrl, filter: '*.js', From 31844ea53cc08a08ac2fd5342d02e6955e906cae Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Sat, 9 Jun 2018 20:41:30 +0800 Subject: [PATCH 38/46] Update to babel 7 --- template/.babelrc | 19 ------------------- template/babel.config.js | 30 ++++++++++++++++++++++++++++++ template/package.json | 22 ++++++++++++---------- 3 files changed, 42 insertions(+), 29 deletions(-) delete mode 100644 template/.babelrc create mode 100644 template/babel.config.js diff --git a/template/.babelrc b/template/.babelrc deleted file mode 100644 index 6646ce7f96..0000000000 --- a/template/.babelrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - ["env", { - "modules": false, - "targets": { - "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] - } - }], - "stage-2" - ], - "plugins": ["transform-vue-jsx", "transform-runtime"]{{#if_or unit e2e}}, - "env": { - "test": { - "presets": ["env", "stage-2"]{{#if_eq runner "karma"}}, - "plugins": ["transform-vue-jsx", "istanbul"]{{/if_eq}}{{#if_eq runner "jest"}}, - "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]{{/if_eq}} - } - }{{/if_or}} -} diff --git a/template/babel.config.js b/template/babel.config.js new file mode 100644 index 0000000000..2fd9e91a1d --- /dev/null +++ b/template/babel.config.js @@ -0,0 +1,30 @@ +module.exports = { + presets: [ + ["@babel/preset-env", { + "modules": false + }], + ["@babel/preset-stage-2", { + decoratorsLegacy: true + }] +], + plugins: ["transform-vue-jsx", "@babel/plugin-transform-runtime"]{{#if_or unit e2e}}, + env: { + test: { + presets: [ + "@babel/preset-env", + ["@babel/preset-stage-2", { + decoratorsLegacy: true + }] + ]{{#if_eq runner "karma"}}, + plugins: [ + "transform-vue-jsx", + "istanbul" + ]{{/if_eq}}{{#if_eq runner "jest"}}, + plugins: [ + "transform-vue-jsx", + "@babel/plugin-transform-modules-commonjs", + "dynamic-import-node" + ]{{/if_eq}} + } + }{{/if_or}} +} diff --git a/template/package.json b/template/package.json index 767d452d2d..a5a1e847a8 100644 --- a/template/package.json +++ b/template/package.json @@ -49,8 +49,10 @@ {{/if_eq}} {{/lint}} {{#if_eq runner "jest"}} - "babel-jest": "^21.0.2", + "babel-core": "^7.0.0-0", + "babel-jest": "^23.0.1", "babel-plugin-dynamic-import-node": "^1.2.0", + "@babel/plugin-transform-modules-commonjs": "^7.0.0-beta.49", "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", "jest": "^22.0.4", "jest-serializer-vue": "^0.3.0", @@ -72,11 +74,11 @@ "sinon": "^4.0.0", "sinon-chai": "^3.0.0", "inject-loader": "^4.0.1", - "babel-plugin-istanbul": "^4.1.1", + "babel-plugin-istanbul": "^4.1.6", "phantomjs-prebuilt": "^2.1.14", {{/if_eq}} {{#e2e}} - "babel-register": "^6.22.0", + "@babel/register": "^7.0.0-beta.49", "chromedriver": "^2.38.2", "geckodriver": "^1.11.0", "cross-spawn": "^6.0.5", @@ -84,14 +86,14 @@ "selenium-server": "^3.11.0", {{/e2e}} "autoprefixer": "^8.3.0", - "babel-core": "^6.26.3", + "@babel/core": "^7.0.0-beta.49", + "@babel/plugin-syntax-jsx": "^7.0.0-beta.49", + "@babel/plugin-transform-runtime": "^7.0.0-beta.49", + "@babel/preset-env": "^7.0.0-beta.49", + "@babel/preset-stage-2": "^7.0.0-beta.49", "babel-helper-vue-jsx-merge-props": "^2.0.3", - "babel-loader": "^7.1.1", - "babel-plugin-syntax-jsx": "^6.18.0", - "babel-plugin-transform-runtime": "^6.22.0", - "babel-plugin-transform-vue-jsx": "^3.5.0", - "babel-preset-env": "^1.3.2", - "babel-preset-stage-2": "^6.22.0", + "babel-loader": "^8.0.0-beta.3", + "babel-plugin-transform-vue-jsx": "^4.0.1", "chalk": "^2.4.1", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.28.0", From 9bdb71600ec9a7737d1291368502b5203d1ccadd Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Sat, 9 Jun 2018 20:42:10 +0800 Subject: [PATCH 39/46] Update deps --- template/package.json | 9 ++++----- template/test/unit/jest.conf.js | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/template/package.json b/template/package.json index a5a1e847a8..ec34cfd197 100644 --- a/template/package.json +++ b/template/package.json @@ -53,10 +53,9 @@ "babel-jest": "^23.0.1", "babel-plugin-dynamic-import-node": "^1.2.0", "@babel/plugin-transform-modules-commonjs": "^7.0.0-beta.49", - "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", - "jest": "^22.0.4", - "jest-serializer-vue": "^0.3.0", - "vue-jest": "^1.0.2", + "jest": "^23.1.0", + "jest-serializer-vue": "^2.0.2", + "vue-jest": "^2.6.0", {{/if_eq}} {{#if_eq runner "karma"}} "cross-env": "^5.0.1", @@ -118,7 +117,7 @@ "vue-template-compiler": "^2.5.2", "portfinder": "^1.0.13", "webpack": "^4.6.0", - "webpack-cli": "^2.0.15", + "webpack-cli": "^3.0.3", "webpack-dev-server": "^3.1.3", "webpack-merge": "^4.1.0" }, diff --git a/template/test/unit/jest.conf.js b/template/test/unit/jest.conf.js index c524e9d7bd..51e27dc417 100644 --- a/template/test/unit/jest.conf.js +++ b/template/test/unit/jest.conf.js @@ -19,7 +19,6 @@ module.exports = { ],{{/e2e}} snapshotSerializers: ['/node_modules/jest-serializer-vue'], setupFiles: ['/test/unit/setup'], - mapCoverage: true, coverageDirectory: '/test/unit/coverage', collectCoverageFrom: [ 'src/**/*.{js,vue}', From 0e7e90cc9146bea3e7df167c67f03dd1fd82413f Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Sat, 9 Jun 2018 20:43:07 +0800 Subject: [PATCH 40/46] Upgrade to vue-cli 3 --- .circleci/config.yml | 3 +-- README.md | 4 ++-- package.json | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b34e37867f..53acfb44c9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,7 @@ version: 2 vm_settings: &vm_settings docker: - # - image: circleci/node:6.14.1-browsers - - image: boundlesscode/node:6.14.1-stretch-browsers-sans-drivers + - image: circleci/node:8-stretch-browsers jobs: install_template_deps: diff --git a/README.md b/README.md index 476c8224a2..46e2ddf42d 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ ## Usage -This is a project template for [vue-cli](https://github.com/vuejs/vue-cli). **It is recommended to use npm 3+ for a more efficient dependency tree.** +This is a project template for [@vue/cli](https://github.com/vuejs/vue-cli). **@vue/cli require Node.js 8 or above (8.10.0+ recommended)** ``` bash -$ npm install -g vue-cli +$ npm install -g @vue/cli @vue/cli-init $ vue init webpack my-project $ cd my-project $ npm install diff --git a/package.json b/package.json index db88d649df..573a96aef5 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "docs:deploy": "bash ./deploy-docs.sh" }, "devDependencies": { - "vue-cli": "^2.8.1" + "@vue/cli": "^3.0.0-beta.16", + "@vue/cli-init": "^3.0.0-beta.16" } } From 922b68c0b93bdb79dfd5c914ee8f5c10c327a4ef Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Sat, 9 Jun 2018 21:49:39 +0800 Subject: [PATCH 41/46] Update docs [ci skip] --- docs/babel.md | 4 ++-- docs/structure.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/babel.md b/docs/babel.md index eaa0ca9d83..f33b206f6a 100644 --- a/docs/babel.md +++ b/docs/babel.md @@ -1,6 +1,6 @@ # Babel Configuration -This boilerplate uses [`babel-preset-env`](https://www.npmjs.com/package/babel-preset-env) for configuring babel. You can read more about it here - http://2ality.com/2017/02/babel-preset-env.html. +This boilerplate uses [`@babel/preset-env`](https://www.npmjs.com/package/@babel/preset-env) for configuring babel. You can read more about it here - http://2ality.com/2017/02/babel-preset-env.html. > A Babel preset that compiles ES2015+ down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments. @@ -19,4 +19,4 @@ However there is a caveat. `browserslist` recommends defining the target in a co } ``` -But the latest stable release of `babel-preset-env`, `v1.6.1` does not support loading the config from `package.json`. So the target environment is repeated in `.babelrc`. If you wish to change your target environment, please be sure to update both `package.json` and `.babelrc`. Note that this has been fixed in the beta version([`@babel/preset-env@7.0.0-beta.34`](https://github.com/babel/babel/tree/master/packages/babel-preset-env)) and the template will be updated once it is out of beta. +[`@babel/preset-env`](https://www.npmjs.com/package/@babel/preset-env) also support `browserslist` config in `package.json`. diff --git a/docs/structure.md b/docs/structure.md index 341a51614b..132029d6d4 100644 --- a/docs/structure.md +++ b/docs/structure.md @@ -28,7 +28,7 @@ │ │   ├── custom-assertions/ # custom assertions for e2e tests │ │   ├── runner.js # test runner script │ │   └── nightwatch.conf.js # test runner config file -├── .babelrc # babel config +├── babel.config.js # babel config ├── .editorconfig # indentation, spaces/tabs and similar settings for your editor ├── .eslintrc.js # eslint config ├── .eslintignore # eslint ignore rules From f43a37936e0e7d07aedecb1f66e5ec5869dd5b2e Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Sun, 10 Jun 2018 14:30:40 +0800 Subject: [PATCH 42/46] Fix typo [ci skip] --- template/babel.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/babel.config.js b/template/babel.config.js index 2fd9e91a1d..575091454d 100644 --- a/template/babel.config.js +++ b/template/babel.config.js @@ -6,7 +6,7 @@ module.exports = { ["@babel/preset-stage-2", { decoratorsLegacy: true }] -], + ], plugins: ["transform-vue-jsx", "@babel/plugin-transform-runtime"]{{#if_or unit e2e}}, env: { test: { From 26ea1fdbc8d2e8aa1a461cf26ee0025312ed3f5b Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Sun, 10 Jun 2018 23:42:12 +0800 Subject: [PATCH 43/46] Fix @babel/register lost --- template/test/e2e/nightwatch.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/test/e2e/nightwatch.conf.js b/template/test/e2e/nightwatch.conf.js index 52502a52a3..878df9e050 100644 --- a/template/test/e2e/nightwatch.conf.js +++ b/template/test/e2e/nightwatch.conf.js @@ -1,4 +1,4 @@ -require('babel-register') +require('@babel/register') var config = require('../../config') const paths = { From 82b49a306ab3be19372a1f7b7e8e6f3a0736c9d1 Mon Sep 17 00:00:00 2001 From: Miau Lightouch Date: Tue, 19 Jun 2018 14:57:48 +0800 Subject: [PATCH 44/46] Fix @babel/runtime missing issue --- template/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/template/package.json b/template/package.json index ec34cfd197..7ead73a37b 100644 --- a/template/package.json +++ b/template/package.json @@ -90,6 +90,7 @@ "@babel/plugin-transform-runtime": "^7.0.0-beta.49", "@babel/preset-env": "^7.0.0-beta.49", "@babel/preset-stage-2": "^7.0.0-beta.49", + "@babel/runtime": "^7.0.0-beta.49", "babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-loader": "^8.0.0-beta.3", "babel-plugin-transform-vue-jsx": "^4.0.1", From 7717e47731c9e077be01754596020761eabd83a7 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Thu, 19 Jul 2018 11:47:47 +0300 Subject: [PATCH 45/46] Removed redundant concatenateModules setting in production webpack config. --- template/build/webpack.prod.conf.js | 1 - 1 file changed, 1 deletion(-) diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index e1cf392389..0ab692d01c 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -77,7 +77,6 @@ const webpackConfig = merge(baseWebpackConfig, { ]) ], optimization: { - concatenateModules: true, splitChunks: { chunks: 'all', cacheGroups: { From 5b90c53391d6cef6a1853742d769ed0b307b81b3 Mon Sep 17 00:00:00 2001 From: Noam Kfir Date: Thu, 19 Jul 2018 11:52:52 +0300 Subject: [PATCH 46/46] Removed redundant namedModules setting in webpack dev config. --- template/build/webpack.dev.conf.js | 1 - 1 file changed, 1 deletion(-) diff --git a/template/build/webpack.dev.conf.js b/template/build/webpack.dev.conf.js index 4541d0b8ef..1fee86bf85 100755 --- a/template/build/webpack.dev.conf.js +++ b/template/build/webpack.dev.conf.js @@ -66,7 +66,6 @@ const devWebpackConfig = merge(baseWebpackConfig, { ]) ], optimization: { - namedModules: true, noEmitOnErrors: true, }, })