Electron Forge & Webpack with multiple windows (Uncaugh expection with built package)

Viewed 1017

I'm completely stuck on this, I've been browsing all over looking for a similar problem but I can't find anything anywhere.

I have a electron application with 2 windows, built in typescript. they run perfectly in Dev environment. Once I run: npm run make. I got an error saying two chunks are Conflict: Multiple chunks emit assets to the same filename index.js (chunks 1 and 2)

Which I then googled around and attempted to fix by putting the output section into my

webpack.main.configuration

module.exports = {
  /**
   * This is the main entry point for your application, it's the first file
   * that runs in the main process.
   */
 // entry: './src/index.ts',
 entry: {
  main: './src/index.ts',
  path: './src/path.ts',
},
 **output: {
       path: __dirname+ '/build',
       filename: '[name].js' 
   },**
  // Put your normal webpack config below here
  module: {
    rules: require('./webpack.rules'),
  },
  resolve: {
    extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json']
  },
};

I think my lack of understanding of webpack might be the problem here. The error I get says A javascript error occurred in the main process

Uncaught excpetion: Error:Cannot Find Module 'path\resources\app.webpack\main'

When I browse into the .webpack folder I find that the main folder doesn't exist but I instead have a "renderer" folder that contains two folders main_window and path

Which is what I'm expecting based on my package.json electron forge plugin-webpack

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

What do I need to change to fix this ? Is this a webpack output issue? do I need to adjust my main process code to the new location to look in renderer instead of main ? Currently I use

declare const MAIN_WINDOW_WEBPACK_ENTRY: any;
declare const PATH_WEBPACK_ENTRY: any;

in my main.ts file to handle paths of the separate windows which I'm told would work in live automatically.

Error .exe shows


0 Answers
Related