Electron-forge: Uncaught Exception: Reference Error _ is undefined

Created on 3 Dec 2018  路  3Comments  路  Source: electron-userland/electron-forge

  • [x] I have read the contribution documentation for this project.
  • [x] I agree to follow the code of conduct that this project follows, as appropriate.
  • [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

I'm receiving the following error in production mode only:

error

It has been very tough to track down the source of this error. I've tried adding:

process.on('uncaughtException, (exception) => // etc.)

with no luck. Has anyone experienced a similar issue?

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

Put the console output here

What command line arguments are you passing?

Put the arguments here

What does your config.forge data in package.json look like?

module.exports = {
  packagerConfig: {

  },
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        name: 'webapp',
        certificateFile: './assets/test.pfx',
        certificatePassword: 'password',
        loadingGif: './assets/installer.gif',
        useAppIdAsId: false,
        iconUrl:
          'http://www.iconarchive.com/download/i78656/icons-land/medical/Documents-Caduceus.ico',
            remoteReleases: 'http://server',
      },
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
  ],
  plugins: [
    [
      '@electron-forge/plugin-webpack',
      {
        mainConfig: './webpack.main.config.js',
        renderer: {
          config: './webpack.renderer.config.js',
          entryPoints: [
            {
              html: './src/index.html',
              js: './src/index.tsx',
              name: 'main_window',
            },
          ],
        },
      },
    ],
  ],
};

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-forge init is a good starting point, if that is not the
source of your problem.

This only started happening a few weeks ago and I have not been able to track down the cause.

Most helpful comment

@damianesteban From the sounds of it you've found a webpack minification bug 馃

I'd suggest you modify your webpack configuration to disable asset minimization and see if that fixes the issue. Even if it doesn't fix it, it should make the error message more readable

All 3 comments

@damianesteban From the sounds of it you've found a webpack minification bug 馃

I'd suggest you modify your webpack configuration to disable asset minimization and see if that fixes the issue. Even if it doesn't fix it, it should make the error message more readable

Thank you. I'll do that and see what happens :).

Thank you. We discovered that it had to do with using the path module before it was actually imported via require.

Was this page helpful?
0 / 5 - 0 ratings