Skip to content

Commit f685044

Browse files
authored
fix(cli-service): don't write entry-wc to node_modules (#6101)
Fixes yarnpkg/berry#2189
1 parent bd1f1b7 commit f685044

File tree

6 files changed

+106
-13
lines changed

6 files changed

+106
-13
lines changed

.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ template
33
template-vue3
44
packages/test
55
temp
6-
entry-wc.js
76
dist
87
__testfixtures__

packages/@vue/cli-service/lib/commands/build/.gitignore

-1
This file was deleted.

packages/@vue/cli-service/lib/commands/build/resolveWcConfig.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ module.exports = (api, { target, entry, name, 'inline-vue': inlineVue }) => {
5858
config.optimization.minimize(false)
5959
}
6060

61+
config
62+
.plugin('webpack-virtual-modules')
63+
.use(require('webpack-virtual-modules'), [{
64+
[dynamicEntry.filePath]: dynamicEntry.content
65+
}])
66+
6167
config
6268
.plugin('web-component-options')
6369
.use(require('webpack').DefinePlugin, [{
@@ -108,7 +114,7 @@ module.exports = (api, { target, entry, name, 'inline-vue': inlineVue }) => {
108114

109115
const entryName = `${libName}${minify ? `.min` : ``}`
110116
rawConfig.entry = {
111-
[entryName]: dynamicEntry
117+
[entryName]: dynamicEntry.filePath
112118
}
113119

114120
Object.assign(rawConfig.output, {

packages/@vue/cli-service/lib/commands/build/resolveWcEntry.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const fs = require('fs')
21
const path = require('path')
32

43
const camelizeRE = /-(\w)/g
@@ -56,6 +55,9 @@ import 'vue-style-loader/lib/addStylesShadow'
5655
import 'vue-loader/lib/runtime/componentNormalizer'
5756
5857
${elements}`.trim()
59-
fs.writeFileSync(filePath, content)
60-
return filePath
58+
59+
return {
60+
filePath: filePath,
61+
content: content
62+
}
6163
}

packages/@vue/cli-service/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"webpack-bundle-analyzer": "^4.1.0",
7979
"webpack-chain": "^6.4.0",
8080
"webpack-dev-server": "^3.11.0",
81-
"webpack-merge": "^4.2.2"
81+
"webpack-merge": "^4.2.2",
82+
"webpack-virtual-modules": "^0.4.1"
8283
},
8384
"peerDependencies": {
8485
"@vue/compiler-sfc": "^3.0.0-beta.14",

yarn.lock

+92-6
Original file line numberDiff line numberDiff line change
@@ -3385,6 +3385,87 @@
33853385
"@vue/babel-plugin-transform-vue-jsx" "^1.2.1"
33863386
camelcase "^5.0.0"
33873387

3388+
"@vue/cli-plugin-babel@file:packages/@vue/cli-plugin-babel":
3389+
version "4.5.8"
3390+
dependencies:
3391+
"@babel/core" "^7.11.6"
3392+
"@vue/babel-preset-app" "^4.5.8"
3393+
"@vue/cli-shared-utils" "^4.5.8"
3394+
babel-loader "^8.1.0"
3395+
cache-loader "^4.1.0"
3396+
thread-loader "^3.0.0"
3397+
webpack "^4.0.0"
3398+
3399+
"@vue/cli-plugin-unit-mocha@file:packages/@vue/cli-plugin-unit-mocha":
3400+
version "4.5.8"
3401+
dependencies:
3402+
"@vue/cli-shared-utils" "^4.5.8"
3403+
jsdom "^16.4.0"
3404+
jsdom-global "^3.0.2"
3405+
mocha "^7.2.0"
3406+
mochapack "^2.0.2"
3407+
3408+
"@vue/cli-service@file:packages/@vue/cli-service":
3409+
version "4.5.8"
3410+
dependencies:
3411+
"@intervolga/optimize-cssnano-plugin" "^1.0.5"
3412+
"@soda/friendly-errors-webpack-plugin" "^1.7.1"
3413+
"@soda/get-current-script" "^1.0.0"
3414+
"@types/minimist" "^1.2.0"
3415+
"@types/webpack" "^4.0.0"
3416+
"@types/webpack-dev-server" "^3.11.0"
3417+
"@vue/cli-overlay" "^4.5.8"
3418+
"@vue/cli-plugin-router" "^4.5.8"
3419+
"@vue/cli-plugin-vuex" "^4.5.8"
3420+
"@vue/cli-shared-utils" "^4.5.8"
3421+
"@vue/component-compiler-utils" "^3.1.2"
3422+
"@vue/preload-webpack-plugin" "^1.1.0"
3423+
"@vue/web-component-wrapper" "^1.2.0"
3424+
acorn "^8.0.1"
3425+
acorn-walk "^8.0.0"
3426+
address "^1.1.2"
3427+
autoprefixer "^9.8.6"
3428+
browserslist "^4.14.1"
3429+
cache-loader "^4.1.0"
3430+
case-sensitive-paths-webpack-plugin "^2.3.0"
3431+
cli-highlight "^2.1.4"
3432+
clipboardy "^2.3.0"
3433+
cliui "^6.0.0"
3434+
copy-webpack-plugin "^6.2.1"
3435+
css-loader "^3.5.3"
3436+
cssnano "^4.1.10"
3437+
debug "^4.1.1"
3438+
default-gateway "^6.0.2"
3439+
dotenv "^8.2.0"
3440+
dotenv-expand "^5.1.0"
3441+
file-loader "^6.1.1"
3442+
fs-extra "^7.0.1"
3443+
globby "^9.2.0"
3444+
hash-sum "^2.0.0"
3445+
html-webpack-plugin "^3.2.0"
3446+
launch-editor-middleware "^2.2.1"
3447+
lodash.defaultsdeep "^4.6.1"
3448+
lodash.mapvalues "^4.6.0"
3449+
lodash.transform "^4.6.0"
3450+
mini-css-extract-plugin "^0.9.0"
3451+
minimist "^1.2.5"
3452+
pnp-webpack-plugin "^1.6.4"
3453+
portfinder "^1.0.26"
3454+
postcss-loader "^3.0.0"
3455+
ssri "^8.0.0"
3456+
terser-webpack-plugin "^4.2.3"
3457+
thread-loader "^3.0.0"
3458+
url-loader "^4.1.1"
3459+
vue-loader "^15.9.2"
3460+
vue-loader-v16 "npm:vue-loader@^16.1.0"
3461+
vue-style-loader "^4.1.2"
3462+
webpack "^4.0.0"
3463+
webpack-bundle-analyzer "^3.8.0"
3464+
webpack-chain "^6.4.0"
3465+
webpack-dev-server "^3.11.0"
3466+
webpack-merge "^4.2.2"
3467+
webpack-virtual-modules "^0.4.1"
3468+
33883469
33893470
version "3.0.2"
33903471
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.2.tgz#7790b7a1fcbba5ace4d81a70ce59096fa5c95734"
@@ -20481,10 +20562,10 @@ vue-jest@^3.0.5:
2048120562
tsconfig "^7.0.0"
2048220563
vue-template-es2015-compiler "^1.6.0"
2048320564

20484-
"vue-loader-v16@npm:vue-loader@^16.0.0-beta.7":
20485-
version "16.0.0-rc.2"
20486-
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-16.0.0-rc.2.tgz#b6a7e7f30d28f35659a83de41f4a1831a4232a04"
20487-
integrity sha512-cz8GK4dgIf1UTC+do80pGvh8BHcCRHLIQVHV9ONVQ8wtoqS9t/+H02rKcQP+TVNg7khgLyQV2+8eHUq7/AFq3g==
20565+
"vue-loader-v16@npm:vue-loader@^16.1.0":
20566+
version "16.1.0"
20567+
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-16.1.0.tgz#e4544abf65cbb3b81f3d5360d95a3e2ae83749a1"
20568+
integrity sha512-fTtCdI7VeyNK0HP4q4y9Z9ts8TUeaF+2/FjKx8CJ/7/Oem1rCX7zIJe+d+jLrVnVNQjENd3gqmANraLcdRWwnQ==
2048820569
dependencies:
2048920570
chalk "^4.1.0"
2049020571
hash-sum "^2.0.0"
@@ -20560,7 +20641,7 @@ vue-style-loader@^4.1.0, vue-style-loader@^4.1.2:
2056020641
hash-sum "^1.0.2"
2056120642
loader-utils "^1.0.2"
2056220643

20563-
vue-template-compiler@^2.6.10, vue-template-compiler@^2.6.12:
20644+
vue-template-compiler@^2.6.10, vue-template-compiler@^2.6.11, vue-template-compiler@^2.6.12:
2056420645
version "2.6.12"
2056520646
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz#947ed7196744c8a5285ebe1233fe960437fcc57e"
2056620647
integrity sha512-OzzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtByg==
@@ -20589,7 +20670,7 @@ vue-virtual-scroller@^1.0.10:
2058920670
vue-observe-visibility "^0.4.4"
2059020671
vue-resize "^0.4.5"
2059120672

20592-
vue@^2.6.10, vue@^2.6.12:
20673+
vue@^2.6.10, vue@^2.6.11, vue@^2.6.12:
2059320674
version "2.6.12"
2059420675
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123"
2059520676
integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==
@@ -20920,6 +21001,11 @@ webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-
2092021001
source-list-map "^2.0.0"
2092121002
source-map "~0.6.1"
2092221003

21004+
webpack-virtual-modules@^0.4.1:
21005+
version "0.4.1"
21006+
resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.4.1.tgz#cae5a7085d34331d077225f77037bea233dbfdad"
21007+
integrity sha512-BH/RKOHk223WdBDLFqghztx3DF5AqR3CKg3ue1KN9S1SAaXP68Kj/4rF0lsdysxXaanzx7aWl1u0+lnfj7+OtQ==
21008+
2092321009
webpack@^4.0.0, webpack@^4.8.1:
2092421010
version "4.44.2"
2092521011
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.44.2.tgz#6bfe2b0af055c8b2d1e90ed2cd9363f841266b72"

0 commit comments

Comments
 (0)