electron-userland / electron-compile

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

addBypassChecker not working #313

Open rivafarabi opened 5 years ago

rivafarabi commented 5 years ago

I have a problem where I can't load a javascript module outside the packaged electron app.

Here is my code

const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require;
const extFolder = fs.readdirSync(extensionsDir);

extFolder.forEach(name => {
      extModules[name] = requireFunc(`${path.join(extensionsDir, name)}`);
      let packageJsonFile = path.join(extensionsDir, name, 'package.json');
      fs.readFile(packageJsonFile, 'utf8', function (err, data) {
        if (err) {
          log.error(err);
          return;
        } else {
          extDescriptions.push(JSON.parse(data));
        }
      });
      extCommands = extCommands.concat(extModules[name].selections);
});

It works fine in both development and production mode. But when I start to use electron-compile, it only works in dev mode.

I tried using addBypassChecker((filePath) => true); as mentioned in #199 but no luck.

Is there any way to solve this? Thanks