Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Cannot require() node modules in builds #54

Closed
corbanCloud opened this issue Nov 2, 2016 · 2 comments
Closed

Cannot require() node modules in builds #54

corbanCloud opened this issue Nov 2, 2016 · 2 comments
Labels

Comments

@corbanCloud
Copy link

corbanCloud commented Nov 2, 2016

So I wanted to create a simple GUI to start up a BrowserSync server for our QA team.
I cannot figure out why browsersync is unavailable after building.

The app works as expected when using it in development via
npm run dev

After I try to build the app for darwin using:
npm run build:darwin

The app seems to build fine, but after trying to run it I get the error:
"Uncaught Exception: Error Cannot Find Module 'browser-sync' ... "

I have followed the steps outlined here:
https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md
for building node modules for electron but have not seen any difference in the outcome. I'm wondering if i missed something in configuring the webpack build?

  • Node version: v5.9.1
  • NPM version: 3.7.3
  • vue-cli version: 2.4.0
  • Operating System: macOS Sierra 10.21.1
@SimulatedGREG
Copy link
Owner

SimulatedGREG commented Nov 3, 2016

@corbanCloud

If you are trying to use any npm packages within the scope of electron.js (or the main process), it will not be available in production builds as the current setup ONLY bundles the renderer process.

More Info

Related: #50, #22

@corbanCloud
Copy link
Author

Ahhh ok so after reading the comments with is due to the web pack build not cooperating with electron-rebuild

That all makes sense, I'll see if I can find a work around for now.

Thanks for answering I assumed it was an error on my implementation of this and not just something excluded from the feature set.

Other wise this has been really great to use thank you!

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

No branches or pull requests

2 participants