Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds transparent PnP support to Webpack #4953

Merged
merged 4 commits into from Jan 19, 2020

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Dec 12, 2019

What kind of change does this PR introduce? (check at least one)

  • Feature
  • Underlying tools

Does this PR introduce a breaking change? (check one)

  • No

Other information:

Followup to #2850 - I've fixed the remaining issues on our side, only remains one thing! 馃帀

Webpack currently requires using the PnP Webpack plugin in order to properly resolve dependencies (it will be optional starting from Webpack 6). It doesn't have any effect for people that aren't using PnP, so no risks at all 馃檪

yarn.lock Outdated
@@ -7045,7 +7045,7 @@ errorhandler@^1.5.1:
accepts "~1.3.7"
escape-html "~1.0.3"

es-abstract@^1.12.0, es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those changes aren't needed by my diff, they just got there when running yarn add 馃

@@ -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') })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spread is a small trick required for webpack-chain (it mutates the plugin instance, but since the PnP plugin is supposed to be the same instance for every config it crashes when webpack-chain tries to override its previous registration).

@pksunkara
Copy link
Contributor

Looks good to me. But I would wait for @sodatea to merge it.

@pksunkara
Copy link
Contributor

@arcanis Can you rebase this? I would like vue-cli to support the pnp feature. It's really good feature 馃槃

@arcanis
Copy link
Contributor Author

arcanis commented Jan 18, 2020

@pksunkara done! Let me know when it gets released and I'll setup our E2E tests accordingly to confirm everything is good 馃檪

@pksunkara pksunkara merged commit 8fcea22 into vuejs:dev Jan 19, 2020
@pksunkara
Copy link
Contributor

I tested this locally.

mactanxin pushed a commit to mactanxin/vue-cli that referenced this pull request Feb 11, 2020
* feat: adds transparent PnP support to Webpack

* fix: add the plugin name

* fix: now pass tests
@fitzix fitzix mentioned this pull request Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants