Electron-forge: net::ERR_FILE_NOT_FOUND (assets or LazyLoad

Created on 23 Jan 2020  路  1Comment  路  Source: electron-userland/electron-forge

Assets are not getting loaded after making the binary using "yarn make" on all platform (windows/Mac/Linux). We are getting error "net::ERR_FILE_NOT_FOUND". Looks like Js files are pointing to the proper location as per the package.json configuration. but assets and source files are located in different location.

And we are seeing the same issue for component source which uses Lazy import statements

const Login = React.lazy(() => import('./screens/login'));

E.g on Mac

Trying to load the png file from  
/Contents/Resources/app/.webpack/renderer/main_window/33dbdd0177549353eeeb785d02c294af.png

But files are available in.  
/Contents/Resources/app/.webpack/renderer/33dbdd0177549353eeeb785d02c294af.png

package.json

"plugins": [
        [
          "@electron-forge/plugin-webpack",
          {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "html": "./src/index.html",
                  "js": "./src/app.tsx",
                  "name": "main_window"
                }
              ]
            }
          }
        ]
      ]

Sample Project https://github.com/jega-ms/electron-forge-react-typescript-webpack

Screen Shot 2020-01-23 at 5 23 08 PM

File Listing

Screen Shot 2020-01-23 at 5 30 23 PM

Bug webpack

Most helpful comment

1196 Might solve the asset issue you are having... it did for me.

my file-loader ended up looking like

{
  test: /\.(png|svg|jpe?g|gif|webm)$/,
  use: [
    {
      loader: 'file-loader',
      options: {
        name: '[hash]-[name].[ext]',
        outputPath: 'static',
        publicPath: '../static',
      },
    },
  ],
}

>All comments

1196 Might solve the asset issue you are having... it did for me.

my file-loader ended up looking like

{
  test: /\.(png|svg|jpe?g|gif|webm)$/,
  use: [
    {
      loader: 'file-loader',
      options: {
        name: '[hash]-[name].[ext]',
        outputPath: 'static',
        publicPath: '../static',
      },
    },
  ],
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

RobiFerentz picture RobiFerentz  路  4Comments

vintprox picture vintprox  路  3Comments

davidroman0O picture davidroman0O  路  5Comments

liamdawson picture liamdawson  路  4Comments

Skizu picture Skizu  路  5Comments