-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Cannot build Electron Vue app using Yarn 2 PnP #915
Comments
Tried adding @vue/cli as a global npm package as well, but it did not help |
may be related to this electron/electron#22472 |
using this plugin has helped somewhat https://yarnpkg.com/api/modules/plugin_node_modules.html and the nested one is still not getting all of the node_modules copied down from the higher level, this is likely more of an issue for the yarn github |
after using the node-modules nodeLinker mode with Yarn 2 it looks like the reason those node_modules are not in that folder is because they have been hoisted up to the root folder since I am using a yarn workspace and I am getting the issues described here yarnpkg/yarn#4503 |
looks like I need noHoist for use with vue-cli-plugin-electron-builder and it's use of webpack https://classic.yarnpkg.com/blog/2018/02/15/nohoist/ |
See the code snippet on the using native modules section of the docs for yarn workspace support. |
I have looked that over, and don't understand which of my dependencies are native. |
I solved the issue actually by moving my top level package.json down into the folder I am using and not using Yarn 2's workspace feature. Since everything is only happening in one folder, there is no longer a need for hoisting and I can just do everything in one folder. I think the issue is that Yarn 2 has no option to disable hoisting like version 1 did. Even putting it in pnpMode: loose did not solve it. |
the other way I solved it was to manually copy the missing node modules from the root level to the workspace folder node_modules folder |
for anyone seeing this later, perhaps an alternative would have been to use |
I am going to close this issue, since it appears to be more of an issue with Yarn Berry (version 2) than with this plugn. Thanks for the response, and feel free to re-open this issue if you decide it is necessary. |
@JoelTrain have you configured // vue.config.js
module.exports = {
pluginOptions: {
electronBuilder: {
// If you are using Yarn Workspaces, you may have multiple node_modules folders
// List them all here so that VCP Electron Builder can find them
nodeModulesPath: ['../../node_modules', './node_modules']
}
}
} |
Yup I had that configured but the webpack calls in the vue-cli-plugin-electron-builder were not using it. Though I did have multiple node nodules paths in that array |
if (process.versions.pnp) {
const PnpWebpackPlugin = require(`pnp-webpack-plugin`)
config.resolve
.plugin('pnp')
.use(PnpWebpackPlugin)
config.resolveLoader
.plugin('pnp')
.use(PnpWebpackPlugin.moduleLoader(module))
} This block should added to
|
@fanthos until Vue CLI itself supports Yarn PNP, I'm not going to add support to this plugin. See vuejs/vue-cli#2850 for Vue CLI's status. |
Currently in webpackConfig.js, the following lines(L102-L114) should move outside if block. // If dep is in whitelist, don't add it no matter what
if (userExternalsWhitelist.includes(dep)) {
return depList
}
const name = userExternals.find((name) =>
new RegExp(`^${dep}(/|$)`).test(name)
)
// If dep is listed in user external array, it is an external
if (name) {
// Use user-provided name if it exists to support subpaths
depList.push(name || dep)
return depList
} |
Why should those lines be moved outside the if block? I don't see what that would accomplish. |
For example, some pure js package does not have Setting |
If you enable the new native dep checker then it will set that env var and use the new checker. I will be enabling it by default in the next release but I wanted people to test it out beforehand so I don't cause any breaking changes. |
Describe the bug
Able to run
yarn serve
to see the vue app fine, but cannot runyarn electron:serve
without errors.To Reproduce
Here is my package.json while using yarn 2 as my package manager.
Expected behavior
Should start the electron app with no errors.
Environment (please complete the following information):
vue info
:Additional context
Any help with this is apprciated!
I guess maybe the problem is that I do not have @vue/cli installed as a global package.
Is that necessary? I am able to see the regular vue app on the web page without that, just not the electron version.
The text was updated successfully, but these errors were encountered: