Skip to content

Commit 8fcea22

Browse files
arcanispksunkara
authored andcommitted
feat: adds transparent PnP support to Webpack (#4953)
* feat: adds transparent PnP support to Webpack * fix: add the plugin name * fix: now pass tests
1 parent 932e412 commit 8fcea22

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

packages/@vue/cli-service/lib/config/base.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = (api, options) => {
1717
limit: inlineLimit,
1818
// use explicit fallback to avoid regression in url-loader>=1.1.0
1919
fallback: {
20-
loader: 'file-loader',
20+
loader: require.resolve('file-loader'),
2121
options: {
2222
name: genAssetSubPath(dir)
2323
}
@@ -37,6 +37,10 @@ module.exports = (api, options) => {
3737
.publicPath(options.publicPath)
3838

3939
webpackConfig.resolve
40+
// This plugin can be removed once we switch to Webpack 6
41+
.plugin('pnp')
42+
.use({ ...require('pnp-webpack-plugin') })
43+
.end()
4044
.extensions
4145
.merge(['.mjs', '.js', '.jsx', '.vue', '.json', '.wasm'])
4246
.end()
@@ -55,6 +59,9 @@ module.exports = (api, options) => {
5559
)
5660

5761
webpackConfig.resolveLoader
62+
.plugin('pnp-loaders')
63+
.use({ ...require('pnp-webpack-plugin').topLevelLoader })
64+
.end()
5865
.modules
5966
.add('node_modules')
6067
.add(api.resolve('node_modules'))

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

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"lodash.transform": "^4.6.0",
6262
"mini-css-extract-plugin": "^0.8.0",
6363
"minimist": "^1.2.0",
64+
"pnp-webpack-plugin": "^1.5.0",
6465
"portfinder": "^1.0.25",
6566
"postcss-loader": "^3.0.0",
6667
"ssri": "^7.1.0",

yarn.lock

+14-2
Original file line numberDiff line numberDiff line change
@@ -7681,7 +7681,7 @@ eslint-plugin-vue@^4.5.0:
76817681
dependencies:
76827682
vue-eslint-parser "^2.0.3"
76837683

7684-
eslint-plugin-vue@^5.1.0, eslint-plugin-vue@^5.2.2:
7684+
eslint-plugin-vue@^5.0.0, eslint-plugin-vue@^5.1.0, eslint-plugin-vue@^5.2.2:
76857685
version "5.2.3"
76867686
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.3.tgz#3ee7597d823b5478804b2feba9863b1b74273961"
76877687
integrity sha512-mGwMqbbJf0+VvpGR5Lllq0PMxvTdrZ/ZPjmhkacrCHbubJeJOt+T6E3HUzAifa2Mxi7RSdJfC9HFpOeSYVMMIw==
@@ -14302,6 +14302,13 @@ pn@^1.1.0:
1430214302
resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"
1430314303
integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==
1430414304

14305+
pnp-webpack-plugin@^1.5.0:
14306+
version "1.5.0"
14307+
resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.5.0.tgz#62a1cd3068f46d564bb33c56eb250e4d586676eb"
14308+
integrity sha512-jd9olUr9D7do+RN8Wspzhpxhgp1n6Vd0NtQ4SFkmIACZoEL1nkyAdW9Ygrinjec0vgDcWjscFQQ1gDW8rsfKTg==
14309+
dependencies:
14310+
ts-pnp "^1.1.2"
14311+
1430514312
popper.js@^1.15.0:
1430614313
version "1.16.0"
1430714314
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.0.tgz#2e1816bcbbaa518ea6c2e15a466f4cb9c6e2fbb3"
@@ -14952,7 +14959,7 @@ punycode@^2.1.0, punycode@^2.1.1:
1495214959
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
1495314960
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
1495414961

14955-
puppeteer@^1.11.0:
14962+
puppeteer@1.11.0, puppeteer@^1.11.0:
1495614963
version "1.11.0"
1495714964
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.11.0.tgz#63cdbe12b07275cd6e0b94bce41f3fcb20305770"
1495814965
integrity sha512-iG4iMOHixc2EpzqRV+pv7o3GgmU2dNYEMkvKwSaQO/vMZURakwSOn/EYJ6OIRFYOque1qorzIBvrytPIQB3YzQ==
@@ -17460,6 +17467,11 @@ ts-node@^8, ts-node@^8.4.1:
1746017467
source-map-support "^0.5.6"
1746117468
yn "^4.0.0"
1746217469

17470+
ts-pnp@^1.1.2:
17471+
version "1.1.5"
17472+
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.5.tgz#840e0739c89fce5f3abd9037bb091dbff16d9dec"
17473+
integrity sha512-ti7OGMOUOzo66wLF3liskw6YQIaSsBgc4GOAlWRnIEj8htCxJUxskanMUoJOD6MDCRAXo36goXJZch+nOS0VMA==
17474+
1746317475
tsconfig@^7.0.0:
1746417476
version "7.0.0"
1746517477
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7"

0 commit comments

Comments
 (0)