Skip to content

Commit dbf0835

Browse files
committed
upgrade to webpack 4 and vue-loader 15
1 parent 088a965 commit dbf0835

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4250
-4550
lines changed

.babelrc

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
{
22
"presets": [
3-
["env", { "modules": false }],
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7+
}
8+
}],
49
"stage-2"
510
],
611
"plugins": ["transform-runtime", "lodash", "vue-jsx-sync", "jsx-v-model", "transform-vue-jsx"],
7-
"comments": false,
812
"env": {
913
"test": {
1014
"presets": ["env", "stage-2"],
11-
"plugins": [ "istanbul" ]
15+
"plugins": ["transform-runtime", "lodash", "vue-jsx-sync", "jsx-v-model", "transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
1216
}
1317
}
1418
}

.eslintignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
build/*.js
2-
config/*.js
1+
/build/
2+
/config/
3+
/dist/
4+
/*.js
5+
/test/unit/coverage/

.eslintrc.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1+
// https://eslint.org/docs/user-guide/configuring
2+
13
module.exports = {
24
root: true,
3-
parser: 'babel-eslint',
45
parserOptions: {
5-
sourceType: 'module'
6+
parser: 'babel-eslint'
67
},
7-
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8-
extends: 'standard',
8+
env: {
9+
browser: true,
10+
},
11+
extends: [
12+
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13+
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14+
'plugin:vue/essential',
15+
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
16+
'standard'
17+
],
918
// required to lint *.vue files
1019
plugins: [
11-
'html'
20+
'vue'
1221
],
1322
// add your custom rules here
14-
'rules': {
15-
// allow paren-less arrow functions
16-
'arrow-parens': 0,
23+
rules: {
1724
// allow async-await
18-
'generator-star-spacing': 0,
19-
'space-before-function-paren': [2, 'never'],
25+
'generator-star-spacing': 'off',
2026
// allow debugger during development
21-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
27+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
28+
'space-before-function-paren': [2, 'never'],
2229
'comma-dangle': 0
2330
}
2431
}

.gitignore

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
.DS_Store
2-
.idea/
32
node_modules/
3+
/dist/
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7-
test/unit/coverage
8-
test/e2e/reports
9-
selenium-debug.log
10-
.tern-project
11-
dist/
7+
/test/unit/coverage/
8+
9+
# Editor directories and files
10+
.idea
11+
.vscode
12+
*.suo
13+
*.ntvs*
14+
*.njsproj
15+
*.sln

.postcssrc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
module.exports = {
44
"plugins": {
5-
// to edit target browsers: use "browserlist" field in package.json
5+
"postcss-import": {},
6+
"postcss-url": {},
7+
// to edit target browsers: use "browserslist" field in package.json
68
"autoprefixer": {}
79
}
810
}

build/build-doc.js

-36
This file was deleted.

build/build.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
1+
'use strict'
12
require('./check-versions')()
23

34
process.env.NODE_ENV = 'production'
45

5-
var ora = require('ora')
6-
var rm = require('rimraf')
7-
var path = require('path')
8-
var chalk = require('chalk')
9-
var webpack = require('webpack')
10-
var config = require('../config')
11-
var webpackConfig = require('./webpack.prod.conf')
6+
const ora = require('ora')
7+
const rm = require('rimraf')
8+
const path = require('path')
9+
const chalk = require('chalk')
10+
const webpack = require('webpack')
11+
const config = require('../config')
12+
const webpackConfig = require('./webpack.prod.conf')
1213

13-
var spinner = ora('building for production...')
14+
const spinner = ora('building for production...')
1415
spinner.start()
1516

1617
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
1718
if (err) throw err
18-
webpack(webpackConfig, function (err, stats) {
19+
webpack(webpackConfig, (err, stats) => {
1920
spinner.stop()
2021
if (err) throw err
2122
process.stdout.write(stats.toString({
2223
colors: true,
2324
modules: false,
24-
children: false,
25+
children: false, // if you are using ts-loader, setting this to true will make typescript errors show up during build
2526
chunks: false,
2627
chunkModules: false
2728
}) + '\n\n')
2829

30+
if (stats.hasErrors()) {
31+
console.log(chalk.red(' Build failed with errors.\n'))
32+
process.exit(1)
33+
}
34+
2935
console.log(chalk.cyan(' Build complete.\n'))
3036
console.log(chalk.yellow(
3137
' Tip: built files are meant to be served over an HTTP server.\n' +

build/check-versions.js

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
var chalk = require('chalk')
2-
var semver = require('semver')
3-
var packageConfig = require('../package.json')
4-
var shell = require('shelljs')
1+
'use strict'
2+
const chalk = require('chalk')
3+
const semver = require('semver')
4+
const packageConfig = require('../package.json')
5+
const shell = require('shelljs')
6+
57
function exec (cmd) {
68
return require('child_process').execSync(cmd).toString().trim()
79
}
810

9-
var versionRequirements = [
11+
const versionRequirements = [
1012
{
1113
name: 'node',
1214
currentVersion: semver.clean(process.version),
1315
versionRequirement: packageConfig.engines.node
14-
},
16+
}
1517
]
1618

1719
if (shell.which('npm')) {
@@ -23,9 +25,11 @@ if (shell.which('npm')) {
2325
}
2426

2527
module.exports = function () {
26-
var warnings = []
27-
for (var i = 0; i < versionRequirements.length; i++) {
28-
var mod = versionRequirements[i]
28+
const warnings = []
29+
30+
for (let i = 0; i < versionRequirements.length; i++) {
31+
const mod = versionRequirements[i]
32+
2933
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
3034
warnings.push(mod.name + ': ' +
3135
chalk.red(mod.currentVersion) + ' should be ' +
@@ -38,10 +42,12 @@ module.exports = function () {
3842
console.log('')
3943
console.log(chalk.yellow('To use this template, you must update following to modules:'))
4044
console.log()
41-
for (var i = 0; i < warnings.length; i++) {
42-
var warning = warnings[i]
45+
46+
for (let i = 0; i < warnings.length; i++) {
47+
const warning = warnings[i]
4348
console.log(' ' + warning)
4449
}
50+
4551
console.log()
4652
process.exit(1)
4753
}

build/dev-client.js

-9
This file was deleted.

build/dev-server.js

-98
This file was deleted.

0 commit comments

Comments
 (0)