electron-userland / electron-webpack

Scripts and configurations to compile Electron applications using webpack
https://webpack.electron.build/
903 stars 170 forks source link

Electron-webpack not working with webpack5 #408

Open shahkeyur opened 3 years ago

shahkeyur commented 3 years ago

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 commented 3 years ago

Same here ✋🏻

loopmode commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

Do you think we can expect a release with updated dependencies anytime soon? Specifically this and https://github.com/electron-userland/electron-webpack/issues/402 (among others, dependencies move fast and it's been about 7 months since the last release).

shahkeyur commented 3 years ago

@dscalzi +1.

neb-b commented 3 years ago

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

xland commented 3 years ago

How about this issue's progress?

UXDart commented 3 years ago

can we expect a release soon? TIA

lazarljubenovic commented 3 years ago

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

keithslater commented 3 years ago

Any update?

Eli-Black-Work commented 3 years ago

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

kumakichi commented 3 years ago

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 commented 3 years ago

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

Eli-Black-Work commented 3 years ago

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

UXDart commented 3 years ago

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

UXDart commented 3 years ago

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

ogomez92 commented 3 years ago

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

ogomez92 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

Sorry, but how do I build or compile electron-webpack? I'm fairly new to this, I'm used to installing packages and importing them into projects but I dunno how to rebuild dependencies...

On 2/6/21, Jovica Aleksic notifications@github.com wrote:

@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.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/electron-userland/electron-webpack/issues/408#issuecomment-774423274

alii commented 3 years ago

@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.

sentoxaio commented 3 years ago

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

loopmode commented 3 years ago

@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 commented 3 years ago

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

loopmode commented 3 years ago

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 commented 3 years ago

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

loopmode commented 3 years ago

@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 commented 3 years ago

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...

sentoxaio commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

shahkeyur commented 3 years ago

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

Eli-Black-Work commented 3 years ago

Thanks, @shahkeyur! 🙂

phryneas commented 2 years ago

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 commented 2 years ago

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

shahkeyur commented 2 years ago

Hey, Sorry, I don't have any permissions for this repo to create a release. May be @loopmode could help.

On Wed., Jul. 27, 2022, 4:51 a.m. Bartel Eerdekens, < @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/electron-userland/electron-webpack/issues/408#issuecomment-1196444429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIICLM4DPV5UC7L2FRLL3QTVWD2CJANCNFSM4TAOK7IA . You are receiving this because you were mentioned.Message ID: @.***>

Bartel-C8 commented 2 years ago

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 🙏 🤞 !