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

Native modules were not rebuilt during package when webpack template is used #1072

Closed
3 tasks done
jasonlaw-dev opened this issue Aug 2, 2019 · 1 comment · Fixed by #2584
Closed
3 tasks done
Labels
bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates

Comments

@jasonlaw-dev
Copy link

jasonlaw-dev commented Aug 2, 2019

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

The issue is that this loader @marshallofsound/webpack-asset-relocator-loader relocates .node files before they get rebuilt.

npx create-electron-app my-new-app --template=webpack
cd my-new-app
npm i nan-hello-world

edit main.js by adding the following:

const helloworld = require('nan-hello-world');
console.log(helloworld.say())

Run npm run package without npm start

npm run package

When trying to open the packaged app, electron will warn that the native module was compiled against different version using NODE_MODULE_VERSION 64 instead of the required 73.

However, if you run the following

npm un nan-hello-world && npm i nan-hello-world
npm start
# close the app then run
npm run package

The app will run fine because the npm start has already rebuilt the module. @marshallofsound/webpack-asset-relocator-loader is relocating the rebuilt version of the .node files.

To get around this issue with CI tools, I need to manually run

npx electron-rebuild

before running package/make so that the correct .node files are being packed.

@ghost
Copy link

ghost commented Aug 4, 2019

I"m seeing the same thing (i think). I have two native modules, but windows terminal output on appveyor shows this.

`019-08-04T10:44:25.119Z electron-rebuild rebuilding with args: C:\T\electron-packager\win32-x64\app-win32-x64\resources\app 6.0.0 x64 [] false https://electronjs.org/headers [ 'prod', 'optional' ] false
2019-08-04T10:44:25.119Z electron-rebuild identified prod deps: Set {}

It should show something other than an empty Set right?

EDIT: this is running the make command with DEBUG=electron-rebuild
`

@malept malept added the plugin/webpack Issues or pull requests related to first-party webpack plugins/templates label Jan 23, 2020
@malept malept added the bug label Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants