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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron-webpack not working with webpack5 #408

Open
shahkeyur opened this issue Oct 27, 2020 · 39 comments
Open

Electron-webpack not working with webpack5 #408

shahkeyur opened this issue Oct 27, 2020 · 39 comments

Comments

@shahkeyur
Copy link
Contributor

shahkeyur commented Oct 27, 2020

Hey,

I am using these dev dependencies as a starter project.

    "electron": "^10.1.5",
    "electron-webpack": "^2.8.2",
    "webpack": "^5.2.0"

But the electron-webpack seems to be incompatible with the breaking change from webpack 5. I looked at webpack docs, it says namedImports are removed in v5. I tried changing optimization.namedModules: true ↦ optimization.moduleIds: 'named'
in forked repository and I can confirm it works on development, but not sure how to make it compatible with v4 and v5 at same time. Is there anyway it can be solved ? Then I can create a pull request.

┏ Renderer -------------------

  × 「wds」: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
   - configuration.optimization has an unknown property 'namedModules'. These properties are valid:
     object { checkWasmTypes?, chunkIds?, concatenateModules?, emitOnErrors?, flagIncludedChunks?, innerGraph?, mangleExports?, mangleWasmImports?, mergeDuplicateChunks?, minimize?, minimizer?, moduleIds?, noEmitOnErrors?, nodeEnv?, portableRecords?, providedExports?, realContentHash?, removeAvailableModules?, removeEmptyChunks?, runtimeChunk?, sideEffects?, splitChunks?, usedExports? }
     -> Enables/Disables integrated optimizations.
     Did you mean optimization.moduleIds: "named" (BREAKING CHANGE since webpack 5)?

┗ ----------------------------

Thanks.

@alii
Copy link

alii commented Nov 1, 2020

Same here ✋🏻

@loopmode
Copy link
Collaborator

loopmode commented Nov 1, 2020

Fortunately webpack now exposes its version now.
The named modules issue seems to be the only one for now. Let's see what else comes.

@shahkeyur
Copy link
Contributor Author

@loopmode Woohoo! I see it is merged in the repo but when I install electron-webpack with npm, I don't see it using the updated baseTarget version in node_modules. Therefore it still throws error. Is there any known reason ?

You guys are doing great work. I am trying these days to look into repo further and try to improve, but I am a beginner to contribute to open-source. Hopefully I can contribute something to the community here.

@loopmode
Copy link
Collaborator

loopmode commented Nov 6, 2020

@shahkeyur Hey glad to hear you wanna get your hands dirty. It's a good thing to get involved, You learn a lot.

About the merge: so the codebase has been updated, however there has not been a release to npm yet. I think I have the permissions for that, but so far only @develar does the releases. In general, codebase and release are not directly synced.

What you could do is pull this repo, install and build locally, then use it in your project via symlink.
My experience with npm is limited as I had trouble and switched to yarn.
In the local electron-webpack, installed and built, you run npm link or yarn link. This creates a symlink to this local folder somewhere more globally.
Then in your project you run npm link electron-webpack or yarn link electron-webpack to use that linked local version.

Once there is a release, you can use the package installed from npm again.
Note that if you delete and reinstall your node_modules, you'll have to run the second step again (to override the installed package with the linked one).

@dscalzi
Copy link

dscalzi commented Nov 10, 2020

Do you think we can expect a release with updated dependencies anytime soon? Specifically this and #402 (among others, dependencies move fast and it's been about 7 months since the last release).

@shahkeyur
Copy link
Contributor Author

@dscalzi +1.

@neb-b
Copy link

neb-b commented Nov 18, 2020

@develar We would really appreciate a release with what is in master currently.

@xland
Copy link

xland commented Dec 23, 2020

How about this issue's progress?

@UXDart
Copy link

UXDart commented Dec 24, 2020

can we expect a release soon? TIA

@lazarljubenovic
Copy link

What's stopping the release? How can we help?

@keithslater
Copy link

Any update?

@Eli-Black-Work
Copy link

Could we perhaps get a release on NPM with a beta tag? 🙂

@kumakichi
Copy link

kumakichi commented Jan 26, 2021

Hi,guys

the same problem, I modified node_modules/electron-webpack/out/targets/BaseTarget.js manually :

configurator.config.optimization.namedModules = true;
to
// configurator.config.optimization.namedModules = true;

it works.

my package.json

{
  "devDependencies": {
    "electron": "^11.2.1",
    "electron-webpack": "^2.8.2",
    "webpack": "^5.17.0"
  },
  "name": "demoShow",
  "version": "1.0.0",
  "scripts": {
    "start": "electron-webpack dev",
    "build": "electron-webpack build"
  },
  "license": "MIT"
}

@joezappie
Copy link

joezappie commented Feb 3, 2021

Will this be getting a release anytime soon? Also looking to use this with WP5

@Eli-Black-Work
Copy link

Eli-Black-Work commented Feb 3, 2021

@SentoxAIO, Do you have permissions to publish to NPM?

@UXDart
Copy link

UXDart commented Feb 4, 2021

can we know at least if this won't never happen? thx

@UXDart
Copy link

UXDart commented Feb 4, 2021

too many things now needs webpack 5, how is everyone working with that? are you using the repo directly? thx

@ogomez92
Copy link

ogomez92 commented Feb 6, 2021

Same here, cloned electron-webpack master built and linked it ijn my projects... Thanks for not releasing lol @develar

@ogomez92
Copy link

ogomez92 commented Feb 6, 2021

Is it possible to get the yarn linked electron-webpack to use with the cli?
Right now when I do yarn electron-webpack it says that the binary isn't found and it tries to look for it inside the node_modules of the project ☹️
I trried yarn remove elctron-webpack then yarn link electron-webpack then yarn add electron-webpack again same thing.
Thanks.

@loopmode
Copy link
Collaborator

loopmode commented Feb 6, 2021

@ogomez92 I think you have to build or compile your local electron-webpack, then the link should work. And the link should be in packages/electron-webpack, not in the repo root.
If all fails, you could place your local repo "close to" your consuming project and use a relative file path I'm package.json, e.g "electron-webpack": "file:../../electron-webpack/packages/electron-webpack", and run an install afterwards. This would install a copy from there to your local node_modules folder. But again: electron-webpack must have been built beforehand.

I'm not sure but I might have permissions to make an npm release. I spoke about it with @develar once, and I was supposed to enable 2FA for my npm account first. Im not sure how it all ended up, but I never have released a version since.

For now however 1) I don't know the routine, what needs to be done before release and 2) i don't really have the time to take care and figure it out.
But I guess it's worth it.
I will check out whether and how I can publish a beta if and when i find the time between newborn daughter and job-work :)

Btw maybe we need an issue regarding responsibility and maintenance. We need active users who do that, and it seems active users we have. We should get a couple of trustworthy guys together and maybe just do a zoom call or something. Of course with @develar too.
Point is: i have status of maintainer here, but I haven't used electron-webpack in years...I'm not a good maintainer :) we need good, active ones.

@ogomez92
Copy link

ogomez92 commented Feb 6, 2021 via email

@alii
Copy link

alii commented Feb 6, 2021

@loopmode Is this something the community could fork and maintain as a new repo entirely? Since both PRs and releases aren't really happening here.

@veighthedev
Copy link
Contributor

veighthedev commented Feb 6, 2021

@Bosch-Eli-Black No, I can't push any new release, that's why I stopped working on it.

@loopmode
Copy link
Collaborator

loopmode commented Feb 6, 2021

@ogomez92 it's yarn compile in the project root, of course after yarn or yarn install once.
@alii yes of course, that's possible. however that has been possible for years now, but the "community" of this project, unfortunately, hasn't done that.
I'd actually love to do that, @loopmode/electron-webpack, and get rid of module whitelisting and externals etc. But I wouldn't be able to maintain it - i don't actively work with electron in my day-job. As mentioned, if there are people actively working with this, they should be maintaining the package. Be it here or as a fork. And scoped/different package name.

@develar
Copy link
Member

develar commented Feb 6, 2021

If someone willing to help, I can grant push permission (as it was granted to @loopmode, thanks for his work and help).

@loopmode
Copy link
Collaborator

loopmode commented Feb 6, 2021

Btw... I personally am a bit afraid to make release a new version. What if a PR fixes issue XY for user AB but breaks something for all the other users? I don't wanna be responsible for such a mess. And that's why a maintainer should be actively working with the library.

@develar
Copy link
Member

develar commented Feb 6, 2021

@loopmode In this case next tag should be used for release, and in a couple of days/weeks promoted as stable.

@loopmode
Copy link
Collaborator

loopmode commented Feb 6, 2021

@develar great to hear from you!

Still, what I mean is... I'd feel very bad releasing a new version without spending time with it, like just because some people made pressure. Because if something is not okay - and it often isn't with deployments or releases - then you can't just leave it at that, you must keep fixing until it's good. Just doing the release and not supporting it would be irresponsible, and that's why I don't feel okay making a release. In fact I only participate in discussions here on my mobile phone, many times in a short break, while in the bus or at the toilet 😸 that's almost all the attention span i have for a library i don't actively use....

@UXDart
Copy link

UXDart commented Feb 6, 2021

so ... I agree that releasing without having people to fix the issues will be bad... but then that means we can't use this repo anymore... not because there is no release but because no one is working on it. is bad but we better find another solution...

@veighthedev
Copy link
Contributor

I think there are couple people who want to help / work on this project but the problem is, that it isn't very maintain friendly. The source is kinda complicated to understand at the beginning and honestly not that clean.

The key would be to redo the base a bit so that more people can get into it and work on this.

@shahkeyur
Copy link
Contributor Author

Btw... I personally am a bit afraid to make the release a new version. What if a PR fixes issue XY for user AB but breaks something for all the other users? I don't wanna be responsible for such a mess. And that's why a maintainer should be actively working with the library.

@loopmode Indeed. I tried updating this fix in my local modules, and I realize that there could be many other issues.

There are plenty of depreciation errors. Just a few of them are here. Also, I ran into this issue https://stackoverflow.com/questions/64294706/webpack5-automatic-publicpath-is-not-supported-in-this-browser. I fixed it temporarily in RendererTarget by setting publicPath: ''. But it shows we need more testing and debugging on it.

┏ Renderer -------------------

  (node:10560) [DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning: Module.updateHash: Use new ChunkGraph API

┗ ----------------------------
┏ Renderer -------------------

  (node:10560) [DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API

┗ ----------------------------
┏ Renderer -------------------

  (node:10560) [DEP_WEBPACK_CHUNK_GROUP_GET_MODULE_INDEX_2] DeprecationWarning: ChunkGroup.getModuleIndex2 was renamed to getModulePostOrderIndex

┗ ----------------------------

There could be more if we update to webpack 5. We may have electron-webpack@next through npm, where we can test and develop further for stabilizing the release. Then we can release electron-webpack@3.

@Eli-Black-Work
Copy link

Eli-Black-Work commented Feb 9, 2021

Happy to see all the replies from everyone! 🙂

If @develar is okay with it, may I propose this as a path forward:

  1. Start a new issue in this repository titled "Looking for maintainers!" and see if we can find one or two people who are interested in maintaining the module.
  2. Have @develar add whoever he feels comfortable with as maintainers and give them permissions to publish to NPM.
  3. Publish a version of this package to NPM as next (beta), so that people can start testing and reporting bugs.

God willing, I'll be on Chinese New Year vacation from tomorrow until February 17th, so it would be great if someone else could create the "Looking for maintainers!" issue, if @develar is okay with this plan 🙂

@Eli-Black-Work
Copy link

@SentoxAIO Would you still be interested in being a maintainer?

@shahkeyur
Copy link
Contributor Author

I added an issue for maintainer #428. We can move this conversation there.

@Eli-Black-Work
Copy link

Thanks, @shahkeyur! 🙂

@phryneas
Copy link

I have forked this and made it run with webpack 5 - you can find the fork here: https://github.com/phryneas/electron-webpack

Please note that I only did this as part of a spike to evaluate different build systems, so "running" for me does not mean that I covered every possible edge case - and depending if we use it for our product, it might get any updates & maintenance or not. But it might be a good starting point for others.

@Bartel-C8
Copy link

@shahkeyur : Do you see it possible to make a new release? Even an untested beta would be great!

@shahkeyur
Copy link
Contributor Author

shahkeyur commented Jul 27, 2022 via email

@Bartel-C8
Copy link

Thanks for your response! Would be great to create a release from the current master. And one also which contains the need changes to work with Webpack 5. Thanks 🙏 🤞 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests