Open will-hart opened 8 years ago
A bit more investigation... if I add the config:
externals: { spellchecker: "commonjs spellchecker" }
Then install electron-rebuild
and manually specify the -v
and -n
flags in my package.json
:
"rebuild": "electron-rebuild -v 0.36.8 -n 4.0.0"
Run:
npm install
npm run rebuild
Then I can import without error.
I think the issue can be closed but is it worth documenting this a bit more, or at least providing some useful links in the readme?
@will-hart totally agree with you here. I'd been developing an app for macOS and Linux for a while using the same boilerplate, and when I began to develop it for Windows I ran into this problem.
After pulling my hair out for hours trying to find what was causing it I figured out it was this module!
My webpack config is already:
externals: [ 'spellchecker' ]
But every time I import spellchecker
the electron app crashes.
I've tried numerous attempts at using electron-rebuild
but I can't figure out how to get it to work for the life of me!
I'm trying to use
node-spellchecker
with electron-react-boilerplate which useswebpack
. My webpack config is virtually unchanged from this repository, only a few more loaders for fonts etc.If I don't use the
node-loader
modulespellchecker.node
is found but throws an error (e.g. the usual "have you installed the correct loader for this file"). However whenever I use the loader webpack bundles correctly however the electron app has an error if I try torequire('spellchecker')
:I can copy and paste the path directly into Windows 10 Explorer and the file opens in Sublime so I know it exists. My webpack output shows that the file was bundled:
I'm a little overwhelmed by webpack config files but I tried messing about with different externals settings and plugins but can't seem to get it to work. I've also tried using
apm rebuild
as suggested in #9.Am I doing something wrong?