Skip to content

feat: add a @vue/cli-plugin-webpack-4 package for future use #6144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions packages/@vue/cli-plugin-unit-mocha/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,20 @@ module.exports = (api, options, rootOptions, invoking) => {
hasRouter: api.hasPlugin('router')
})

// mochapack currently does not support webpack 5 yet
require('@vue/cli-plugin-webpack-4/generator')(api, {}, rootOptions, invoking)

api.extendPackage({
devDependencies: {
'@vue/cli-plugin-webpack-4': require('../package.json').dependencies['@vue/cli-plugin-webpack-4'],
'@vue/test-utils': isVue3 ? '^2.0.0-0' : '^1.1.0',
'chai': '^4.2.0',
'webpack': '^4.0.0'
'chai': '^4.2.0'
},
scripts: {
'test:unit': 'vue-cli-service test:unit'
},
// Force resolutions is more reliable than module-alias
// Yarn and PNPM 5.10+ support this feature
// So we'll try to use that whenever possible
resolutions: {
'@vue/cli-*/webpack': '^4.0.0'
}
})

if (isVue3) {
api.extendPackage({
devDependencies: {
'@vue/server-renderer': '^3.0.0'
}
})
}

if (api.hasPlugin('eslint')) {
applyESLint(api)
}
Expand Down
1 change: 1 addition & 0 deletions packages/@vue/cli-plugin-unit-mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-unit-mocha#readme",
"dependencies": {
"@vue/cli-plugin-webpack-4": "^4.5.8",
"@vue/cli-shared-utils": "^4.5.8",
"jsdom": "^16.4.0",
"jsdom-global": "^3.0.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/@vue/cli-plugin-webpack-4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @vue/cli-plugin-webpack-4

This plugin provides compatibily for webpack 4 in Vue CLI 5.
14 changes: 14 additions & 0 deletions packages/@vue/cli-plugin-webpack-4/generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('@vue/cli').GeneratorPlugin} */
module.exports = (api) => {
api.extendPackage({
devDependencies: {
'webpack': '^4.0.0'
},
// Force resolutions is more reliable than module-alias
// Yarn and PNPM 5.10+ support this feature
// So we'll try to use that whenever possible
resolutions: {
'@vue/cli-*/webpack': '^4.0.0'
}
})
}
8 changes: 8 additions & 0 deletions packages/@vue/cli-plugin-webpack-4/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('@vue/cli-service').ServicePlugin} */
module.exports = () => {
// TODO:
// terser-webpack-plugin v4
// copy-webpack-plugin v6
// html-webpack-plugin v4
// css-minimizer-webpack-plugin v1
}
31 changes: 31 additions & 0 deletions packages/@vue/cli-plugin-webpack-4/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@vue/cli-plugin-webpack-4",
"version": "4.5.8",
"description": "webpack-4 plugin for @vue/cli v5",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-webpack-4"
},
"keywords": [
"vue",
"cli",
"webpack 4"
],
"author": "Haoqun Jiang",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue-cli/issues"
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/@vue/cli-plugin-webpack-4#readme",
"publishConfig": {
"access": "public"
},
"dependencies": {
"webpack": "^4.44.2"
},
"peerDependencies": {
"@vue/cli-service": "^5.0.0-0"
}
}
3 changes: 2 additions & 1 deletion packages/@vue/cli-shared-utils/lib/pluginResolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const officialPlugins = [
'typescript',
'unit-jest',
'unit-mocha',
'vuex'
'vuex',
'webpack-4'
]

exports.isPlugin = id => pluginRE.test(id)
Expand Down