electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 99 forks source link

Asked for [external module] but it was not precompiled! #303

Open jefferson-julio opened 6 years ago

jefferson-julio commented 6 years ago

I'm trying to load a external module in my electron app, but electron-compiler don't allow it. I'm trying to make a app that uses some kind of plugin system, and it load these plugins from some directory outside of the app.

I tried to add the bypass method but it appear to only work on content loaded by html tags (like script tag) and not with the require() method of javascript.

How do I load these modules outside of my app with 'require' bypassing the compiler?

RebelSyntax commented 6 years ago

I've got a similar issue I think.

compiling for deb raspberry pi flavor which is 32bit arm.

"electron": "2.0.0" "electron-prebuilt-compile": "2.0.0" "electron-forge": "5.2.2" "electron-compile": "6.4.2"

I've got an addon that references a 3rd party shared object which I've placed in my /urs/local/lib directory. I link the shared object library in my addon with binding.gyp and build it with node-gyp rebuild.

I reference my module, which is named myPrecompiledModule.node in the rest of my app to use functions and methods inside of the shared library. No problem.

This all works find when I start my project with electron-forge start. I get no errors when packaging the deb package and installing.

But when I run my project from the installed file, I get the message:

A JavaScript error occurred in the main process Uncaught Exception: Error: Asked for /usr/lib/myInstalledApp/resources/app.asar/myPrecompiledModule but it was not precompiled!

How can I precompile this already precompiled module when I package it with electron-forge --arch=armv7l make?

ppuvanasingam commented 5 years ago

For anyone else running into this issue:

Make sure you put your HTML and any static files inside a sub-folder i.e. dist, or src, then point all the files to the correct directory, and recompile, that seems to resolve my issue.

This issue seems to happen, for me, when the HTML file is loaded from the root directory.