-
-
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
Enforces require.resolve for loaders #4532
Conversation
221b258
to
abc98bc
Compare
For the record, I'll review this PR later after the server-side issue of the npm registry resolves (npm/cli#224 (comment)). |
Seems like the upstream issue has finally been fixed 😅 |
Well, seems there's still a bug in the npm cli… |
@sodatea I've updated my PR to exclusively use |
Cool! I'll try it out |
Just finished the tests locally and this PR looks good to me. It's late in the night so I'll just write some quick notes here. I'll check them when I get up tomorrow. Here's what we need to do next in the Vue ecosystem:
After these changes, a default project scaffolded by Vue CLI pretty much works with yarn 2, except for the postcss (autoprefixer) configuration.
Any advice would be greatly appreciated :) |
Found the root cause. It's not because of postcss config loading, but due to no explicit dependency on And we will be able to support yarn 2 in the next release! 🎉 |
Hey @arcanis, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚 |
That's awesome! If you ping me when it lands I'll add a test to our Toolchain CI to track potential regressions 😃
In this case wouldn't it work if you were to define |
Yeah sure 😃
It's in the user's project so I think it's too explicit (novice users may wondering what this dependency actually does, and many have already asked to hide away as many implementation details as possible from their projects). So I'll just load the config in |
BTW, is there any equivalent to the |
@arcanis Now I should be able to scaffold a project with the default preset and switch it to Yarn 2: yarn global add @vue/cli@next
vue create -d hello-yarn-2
cd hello-yarn-2
yarn policies set-version v2
yarn
yarn add vue-cli-plugin-pnp -D
yarn serve (This now fails with an error But if I want to create a project with Also, will yarnpkg/berry#531 be backported to Yarn v1? |
It's "renamed". The problem with So instead you have two recommended ways to set the registry (and most configuration values):
As for "how to know which way to set the registry depending on the Yarn version", I'm afraid I don't have a better answer than calling
It seems rather low impact so not a high priority at the moment, but maybe. At the moment I'm really focusing my efforts to ship the v2 this year 🙂 |
Also good news! Running To test yourself, once you're on the v2, you can run the following command:
( [edit] The fixed build is now the one pointed by |
Cool, I'll use the environment variable approach. One more thing,
|
I just republished |
Hey @sodatea! I've just started to integrate Vue-CLI in our E2E battery, but I have a weird problem: when running {
"name": "my-vue",
"version": "0.1.0",
"private": true,
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0-beta.0",
"@vue/cli-plugin-eslint": "^4.1.0-beta.0",
"@vue/cli-service": "^4.1.0-beta.0"
}
} Any idea as to what I might be doing wrong? I suppose the init fails somewhere, but I'm not sure why it wouldn't hard-crash ... 🤔 |
Nevermind, I found the reason - since the |
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Other information:
This PR enforces
require.resolve
when adding new loaders to the Webpack configuration. Doing this is strongly advised, as otherwise Webpack itself will do therequire
calls and may return the wrong plugins depending on the hoisting.I had to add a few missing dependencies (
cache-loader
andthread-loader
) to two plugins, and a few optional peer dependencies (a feature available in Yarn and npm 6.11+) for optional integrations (such as less, sass, etc).Ref yarnpkg/berry#368