Skip to content

Commit c72b6b0

Browse files
authored
feat: add a @vue/cli-plugin-webpack-4 package for future use (#6144)
1 parent a672585 commit c72b6b0

File tree

7 files changed

+64
-17
lines changed

7 files changed

+64
-17
lines changed

packages/@vue/cli-plugin-unit-mocha/generator/index.js

+5-16
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,20 @@ module.exports = (api, options, rootOptions, invoking) => {
77
hasRouter: api.hasPlugin('router')
88
})
99

10+
// mochapack currently does not support webpack 5 yet
11+
require('@vue/cli-plugin-webpack-4/generator')(api, {}, rootOptions, invoking)
12+
1013
api.extendPackage({
1114
devDependencies: {
15+
'@vue/cli-plugin-webpack-4': require('../package.json').dependencies['@vue/cli-plugin-webpack-4'],
1216
'@vue/test-utils': isVue3 ? '^2.0.0-0' : '^1.1.0',
13-
'chai': '^4.2.0',
14-
'webpack': '^4.0.0'
17+
'chai': '^4.2.0'
1518
},
1619
scripts: {
1720
'test:unit': 'vue-cli-service test:unit'
18-
},
19-
// Force resolutions is more reliable than module-alias
20-
// Yarn and PNPM 5.10+ support this feature
21-
// So we'll try to use that whenever possible
22-
resolutions: {
23-
'@vue/cli-*/webpack': '^4.0.0'
2421
}
2522
})
2623

27-
if (isVue3) {
28-
api.extendPackage({
29-
devDependencies: {
30-
'@vue/server-renderer': '^3.0.0'
31-
}
32-
})
33-
}
34-
3524
if (api.hasPlugin('eslint')) {
3625
applyESLint(api)
3726
}

packages/@vue/cli-plugin-unit-mocha/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
},
2323
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-unit-mocha#readme",
2424
"dependencies": {
25+
"@vue/cli-plugin-webpack-4": "^4.5.8",
2526
"@vue/cli-shared-utils": "^4.5.8",
2627
"jsdom": "^16.4.0",
2728
"jsdom-global": "^3.0.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# @vue/cli-plugin-webpack-4
2+
3+
This plugin provides compatibily for webpack 4 in Vue CLI 5.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @type {import('@vue/cli').GeneratorPlugin} */
2+
module.exports = (api) => {
3+
api.extendPackage({
4+
devDependencies: {
5+
'webpack': '^4.0.0'
6+
},
7+
// Force resolutions is more reliable than module-alias
8+
// Yarn and PNPM 5.10+ support this feature
9+
// So we'll try to use that whenever possible
10+
resolutions: {
11+
'@vue/cli-*/webpack': '^4.0.0'
12+
}
13+
})
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('@vue/cli-service').ServicePlugin} */
2+
module.exports = () => {
3+
// TODO:
4+
// terser-webpack-plugin v4
5+
// copy-webpack-plugin v6
6+
// html-webpack-plugin v4
7+
// css-minimizer-webpack-plugin v1
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@vue/cli-plugin-webpack-4",
3+
"version": "4.5.8",
4+
"description": "webpack-4 plugin for @vue/cli v5",
5+
"main": "index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/vuejs/vue-cli.git",
9+
"directory": "packages/@vue/cli-plugin-webpack-4"
10+
},
11+
"keywords": [
12+
"vue",
13+
"cli",
14+
"webpack 4"
15+
],
16+
"author": "Haoqun Jiang",
17+
"license": "MIT",
18+
"bugs": {
19+
"url": "https://github.com/vuejs/vue-cli/issues"
20+
},
21+
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/@vue/cli-plugin-webpack-4#readme",
22+
"publishConfig": {
23+
"access": "public"
24+
},
25+
"dependencies": {
26+
"webpack": "^4.44.2"
27+
},
28+
"peerDependencies": {
29+
"@vue/cli-service": "^5.0.0-0"
30+
}
31+
}

packages/@vue/cli-shared-utils/lib/pluginResolution.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const officialPlugins = [
1313
'typescript',
1414
'unit-jest',
1515
'unit-mocha',
16-
'vuex'
16+
'vuex',
17+
'webpack-4'
1718
]
1819

1920
exports.isPlugin = id => pluginRE.test(id)

0 commit comments

Comments
 (0)