-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Yarn PnP support #2850
Comments
This would be awesome for many usecases: Using vue-cli in Docker, Windows WSL or Vagrant currently is a pain (because of >100.000 mounted and synced files inside node_modules). Without this everything would be gone. Do you consider this integrating in vue-cli (when choosing "yarn" inside the installation wizard)? |
yeah,i would glad see the supporting for pnp,i want know |
I was trying to setup
Now I’m at a point where I have no idea to proceed. Running
Does anybody have an idea? |
@bodograumann |
@sodatea Would you be open to a PR that fixes (most of) the issues I encountered, while not breaking current functionality? |
Yeah I would love to see that PR |
I look forward to being able to support |
@bodograumann Yes, I also encountered the same error |
I found an easy way to combine vue-cli and yarn pnp https://github.com/hufeng/vue-love-pnp key point,Add a webpack.config.js to the current project directory and Add missing dependencies。 // this file is for cases where we need to access the
// webpack config as a file when using CLI commands.
const Service = require('@vue/cli-service/lib/Service');
let service = process.VUE_CLI_SERVICE;
if (!service || process.env.VUE_CLI_API_MODE) {
// const Service = require('./lib/Service');
service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd());
service.init(process.env.VUE_CLI_MODE || process.env.NODE_ENV);
}
module.exports = service.resolveWebpackConfig();
|
After PR #4953 was merged, PnP works. But if global caching is enabled, an error occurs, it looks like there is a problem with eslint-plugin-vue. ERROR STACK:
|
This is working mostly out of the box in recent versions thanks to what @fitzix mentions and @yarnpkg/plugin-compat. Even with typescript. All I had to do was modify the dependencies for some 3rd party loaders, and for typescript (for tslib). You mileage may vary depending on the state of @yarnpkg/plugin-compat - which is updated regularly. I also had to get rid of references to node_modules in typeRoots in my tsconfig.json. Recommend this issue be closed @LinusBorg packageExtensions:
"webpack-sharp-loader@*":
dependencies:
"file-loader": "*"
"@vuetify/loader-shared@*":
dependencies:
"vue": "*"
"vue-cli-plugin-vuetify@*":
peerDependencies:
"vue": "*"
"vue-loader@*":
dependencies:
"vue": "*"
"@vue/compiler-sfc": "*"
"lipsurf.com@*":
dependencies:
"tslib": "*" @vue/cli 5.0.4 |
What problem does this feature solve?
yarn 1.12 supports PnP: https://github.com/yarnpkg/rfcs/blob/master/accepted/0000-plug-an-play.md
yarnpkg/yarn#6382
What does the proposed API look like?
I tried to get it to work, but the default project was missing a whole bunch of peer dependencies in the package.lock. Once that was resolved, the vue-cli webpack rules would have to be adjusted with:
https://github.com/arcanis/pnp-webpack-plugin
And for jest:
https://github.com/arcanis/jest-pnp-resolver
The text was updated successfully, but these errors were encountered: