electron-compile icon indicating copy to clipboard operation
electron-compile copied to clipboard

addBypassChecker not working

Open rivafarabi opened this issue 5 years ago • 0 comments

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

rivafarabi avatar Oct 18 '18 16:10 rivafarabi