Skip to content

Commit

Permalink
feat: adds transparent PnP support to Webpack (#4953)
Browse files Browse the repository at this point in the history
* feat: adds transparent PnP support to Webpack

* fix: add the plugin name

* fix: now pass tests
  • Loading branch information
arcanis authored and pksunkara committed Jan 19, 2020
1 parent 932e412 commit 8fcea22
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
9 changes: 8 additions & 1 deletion packages/@vue/cli-service/lib/config/base.js
Expand Up @@ -17,7 +17,7 @@ module.exports = (api, options) => {
limit: inlineLimit,
// use explicit fallback to avoid regression in url-loader>=1.1.0
fallback: {
loader: 'file-loader',
loader: require.resolve('file-loader'),
options: {
name: genAssetSubPath(dir)
}
Expand All @@ -37,6 +37,10 @@ module.exports = (api, options) => {
.publicPath(options.publicPath)

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

webpackConfig.resolveLoader
.plugin('pnp-loaders')
.use({ ...require('pnp-webpack-plugin').topLevelLoader })
.end()
.modules
.add('node_modules')
.add(api.resolve('node_modules'))
Expand Down
1 change: 1 addition & 0 deletions packages/@vue/cli-service/package.json
Expand Up @@ -61,6 +61,7 @@
"lodash.transform": "^4.6.0",
"mini-css-extract-plugin": "^0.8.0",
"minimist": "^1.2.0",
"pnp-webpack-plugin": "^1.5.0",
"portfinder": "^1.0.25",
"postcss-loader": "^3.0.0",
"ssri": "^7.1.0",
Expand Down
16 changes: 14 additions & 2 deletions yarn.lock
Expand Up @@ -7681,7 +7681,7 @@ eslint-plugin-vue@^4.5.0:
dependencies:
vue-eslint-parser "^2.0.3"

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

pnp-webpack-plugin@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.5.0.tgz#62a1cd3068f46d564bb33c56eb250e4d586676eb"
integrity sha512-jd9olUr9D7do+RN8Wspzhpxhgp1n6Vd0NtQ4SFkmIACZoEL1nkyAdW9Ygrinjec0vgDcWjscFQQ1gDW8rsfKTg==
dependencies:
ts-pnp "^1.1.2"

popper.js@^1.15.0:
version "1.16.0"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.0.tgz#2e1816bcbbaa518ea6c2e15a466f4cb9c6e2fbb3"
Expand Down Expand Up @@ -14952,7 +14959,7 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

puppeteer@^1.11.0:
puppeteer@1.11.0, puppeteer@^1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.11.0.tgz#63cdbe12b07275cd6e0b94bce41f3fcb20305770"
integrity sha512-iG4iMOHixc2EpzqRV+pv7o3GgmU2dNYEMkvKwSaQO/vMZURakwSOn/EYJ6OIRFYOque1qorzIBvrytPIQB3YzQ==
Expand Down Expand Up @@ -17460,6 +17467,11 @@ ts-node@^8, ts-node@^8.4.1:
source-map-support "^0.5.6"
yn "^4.0.0"

ts-pnp@^1.1.2:
version "1.1.5"
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.5.tgz#840e0739c89fce5f3abd9037bb091dbff16d9dec"
integrity sha512-ti7OGMOUOzo66wLF3liskw6YQIaSsBgc4GOAlWRnIEj8htCxJUxskanMUoJOD6MDCRAXo36goXJZch+nOS0VMA==

tsconfig@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7"
Expand Down

0 comments on commit 8fcea22

Please sign in to comment.