Skip to content

Commit 3c15450

Browse files
committed
Merge branch 'develop'
* develop: bump v1.2.4 revert #996 chunk names to minify prodution JS (#1086) fix missing comma Batman! add missing cacheBusting option make jest ignore the e2e test folder because its likely to contain files matching the jest's filename pattern Improved Jest config (#1074) Fix # 1070 When index.html has a positional variable, the error can be printed correctly (#1071) [enhancement]Remove useless files and performance enhancement in dev server. (#1072)
2 parents 5b138f3 + 7ba65e8 commit 3c15450

File tree

10 files changed

+54
-42
lines changed

10 files changed

+54
-42
lines changed

meta.js

+2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ module.exports = {
105105
".eslintrc.js": "lint",
106106
".eslintignore": "lint",
107107
"config/test.env.js": "unit || e2e",
108+
"build/webpack.test.conf.js": "e2e || (unit && runner === 'karma')",
108109
"test/unit/**/*": "unit",
109110
"test/unit/index.js": "unit && runner === 'karma'",
111+
"test/unit/jest.conf.js": "unit && runner === 'jest'",
110112
"test/unit/karma.conf.js": "unit && runner === 'karma'",
111113
"test/unit/specs/index.js": "unit && runner === 'karma'",
112114
"test/unit/setup.js": "unit && runner === 'jest'",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-template-webpack",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"license": "MIT",
55
"description": "A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.",
66
"scripts": {

template/.babelrc

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
}],
66
"stage-2"
77
],
8-
"plugins": ["transform-runtime"],
8+
"plugins": ["transform-runtime"]{{#if_or unit e2e}},
99
"env": {
1010
"test": {
1111
"presets": ["env", "stage-2"]{{#if_eq runner "karma"}},
12-
"plugins": ["istanbul"]
13-
{{/if_eq}}
12+
"plugins": ["istanbul"]{{/if_eq}}{{#if_eq runner "jest"}},
13+
"plugins": ["transform-es2015-modules-commonjs", "dynamic-import-node"]{{/if_eq}}
1414
}
15-
}
15+
}{{/if_or}}
1616
}

template/build/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ exports.createNotifierCallback = function () {
8787
}
8888
const error = errors[0]
8989

90-
const filename = error.file.split('!').pop()
90+
const filename = error.file && error.file.split('!').pop()
9191
notifier.notify({
9292
title: pkg.name,
9393
message: severity + ': ' + error.name,

template/build/vue-loader.conf.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = {
1313
extract: isProduction
1414
}),
1515
cssSourceMap: sourceMapEnabled,
16+
cacheBusting: config.dev.cacheBusting,
1617
transformToRequire: {
1718
video: 'src',
1819
source: 'src',

template/build/webpack.dev.conf.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
1414
},
1515
// cheap-module-eval-source-map is faster for development
1616
devtool: config.dev.devtool,
17-
17+
1818
// these devServer options should be customized in /config/index.js
1919
devServer: {
2020
clientLogLevel: 'warning',
2121
historyApiFallback: true,
2222
hot: true,
23+
compress: true,
2324
host: process.env.HOST || config.dev.host,
2425
port: process.env.PORT || config.dev.port,
2526
open: config.dev.autoOpenBrowser,
@@ -37,7 +38,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
3738
plugins: [
3839
new webpack.DefinePlugin({
3940
'process.env': require('../config/dev.env')
40-
}),
41+
}),
4142
new webpack.HotModuleReplacementPlugin(),
4243
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
4344
new webpack.NoEmitOnErrorsPlugin(),

template/build/webpack.prod.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const webpackConfig = merge(baseWebpackConfig, {
2626
output: {
2727
path: config.build.assetsRoot,
2828
filename: utils.assetsPath('js/[name].[chunkhash].js'),
29-
chunkFilename: utils.assetsPath('js/[name].[chunkhash].js')
29+
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
3030
},
3131
plugins: [
3232
// http://vuejs.github.io/vue-loader/en/workflow/production.html

template/config/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict'
2-
// Template version: 1.2.3
2+
// Template version: 1.2.4
33
// see http://vuejs-templates.github.io/webpack for documentation.
44

55
const path = require('path')
@@ -14,7 +14,7 @@ module.exports = {
1414

1515
// Various Dev Server settings
1616
host: 'localhost', // can be overwritten by process.env.HOST
17-
port: 8080, // can be overwritten by process.env.HOST, if port is in use, a free one will be determined
17+
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
1818
autoOpenBrowser: false,
1919
errorOverlay: true,
2020
notifyOnErrors: true,
@@ -47,7 +47,7 @@ module.exports = {
4747
// just be aware of this issue when enabling this option.
4848
cssSourceMap: false,
4949
},
50-
50+
5151
build: {
5252
// Template for index.html
5353
index: path.resolve(__dirname, '../dist/index.html'),
@@ -64,14 +64,14 @@ module.exports = {
6464
productionSourceMap: true,
6565
// https://webpack.js.org/configuration/devtool/#production
6666
devtool: '#source-map',
67-
67+
6868
// Gzip off by default as many popular static hosts such as
6969
// Surge or Netlify already gzip all static assets for you.
7070
// Before setting to `true`, make sure to:
7171
// npm install --save-dev compression-webpack-plugin
7272
productionGzip: false,
7373
productionGzipExtensions: ['js', 'css'],
74-
74+
7575
// Run the build command with an extra argument to
7676
// View the bundle analyzer report after build finishes:
7777
// `npm run build --report`

template/package.json

+4-28
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
99
"start": "npm run dev",
1010
{{#if_eq runner "jest"}}
11-
"unit": "jest test/unit/specs --coverage",
11+
"unit": "jest --config test/unit/jest.conf.js --coverage",
1212
{{/if_eq}}
1313
{{#if_eq runner "karma"}}
1414
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
@@ -67,7 +67,10 @@
6767
"webpack-bundle-analyzer": "^2.9.0",
6868
{{#if_eq runner "jest"}}
6969
"babel-jest": "^21.0.2",
70+
"babel-plugin-dynamic-import-node": "^1.2.0",
71+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
7072
"jest": "^21.2.0",
73+
"jest-serializer-vue": "^0.3.0",
7174
"vue-jest": "^1.0.2",
7275
{{/if_eq}}
7376
{{#if_eq runner "karma"}}
@@ -112,33 +115,6 @@
112115
"webpack-dev-server": "^2.9.1",
113116
"webpack-merge": "^4.1.0"
114117
},
115-
{{#if_eq runner "jest"}}
116-
"jest": {
117-
"moduleFileExtensions": [
118-
"js",
119-
"json",
120-
"vue"
121-
],
122-
"moduleNameMapper": {
123-
"^@/(.*)$": "<rootDir>/src/$1"
124-
},
125-
"transform": {
126-
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
127-
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
128-
},
129-
"setupFiles": ["<rootDir>/test/unit/setup"],
130-
"mapCoverage": true,
131-
"coverageDirectory": "<rootDir>/test/unit/coverage",
132-
"collectCoverageFrom" : [
133-
"src/**/*.{js,vue}",
134-
"!src/main.js",
135-
{{#router}}
136-
"!src/router/index.js",
137-
{{/router}}
138-
"!**/node_modules/**"
139-
]
140-
},
141-
{{/if_eq}}
142118
"engines": {
143119
"node": ">= 4.0.0",
144120
"npm": ">= 3.0.0"

template/test/unit/jest.conf.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
rootDir: path.resolve(__dirname, '../../'),
5+
moduleFileExtensions: [
6+
'js',
7+
'json',
8+
'vue'
9+
],
10+
moduleNameMapper: {
11+
'^@/(.*)$': '<rootDir>/src/$1'
12+
},
13+
transform: {
14+
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
15+
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
16+
},{{#e2e}}
17+
testPathIgnorePatterns: [
18+
'<rootDir>/test/e2e'
19+
],{{/e2e}}
20+
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
21+
setupFiles: ['<rootDir>/test/unit/setup'],
22+
mapCoverage: true,
23+
coverageDirectory: '<rootDir>/test/unit/coverage',
24+
collectCoverageFrom: [
25+
'src/**/*.{js,vue}',
26+
'!src/main.js',
27+
{{#router}}
28+
'!src/router/index.js',
29+
{{/router}}
30+
'!**/node_modules/**'
31+
]
32+
}

0 commit comments

Comments
 (0)