-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Using got
in a project built with webpack crashes as electron
is used, but not part of package.json
#345
Comments
This is a problem with Webpack. It shouldn't throw on a |
Thanks. |
I created an issue for Webpack: webpack/webpack#5294 |
For anyone coming across this, the conclusion from the webpack discussion that helped me was to add the IgnorePlugin, as: plugins: [new webpack.IgnorePlugin(/^electron$/)] |
For anyone using Next.js, here's the solution @sbj42 proposed in an example
|
IgnorePlugin's config now looks like this: module.exports = {
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^electron$/
}),
]
} |
I have an Ionic project that uses the (node) package trakt.tv that uses
got
. Ionic builds projects with webpack, which unfortunately doesn't like gotrequire()
ingelectron
in the code but not having it as a dependency:Here the relevant part again:
Now
got
doesn't haveelectron
inpackage.json
, that is correct.In normal execution it doesn't even use
electron
, and if I understood that correctly it only has some special config option that includes and uses electron (which then is to be though to be installed by the using project or globally):https://github.com/sindresorhus/got#useelectronnet
got/index.js
Lines 44 to 46 in c0c6bcf
As I don't use electron and don't have
useElectronNet
set, this shouldn't be relevant to me.Did I understand the error correctly?
Is this an Ionic app-scripts problem? (Created a similar ticket to this one at ionic-team/ionic-app-scripts#1116)
Is this a webpack problem?
Is this a
got
problem?Is this my problem and I just have to add electron to my app as a dependency?
Workaround seems to be to add electron to my project myself for now:
npm install electron --save-dev
The text was updated successfully, but these errors were encountered: