electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.41k stars 505 forks source link

Can't set webpack config of preload file #3226

Open seamory opened 1 year ago

seamory commented 1 year ago

Pre-flight checklist

Electron Forge version

6.1.1

Electron version

17.4.11

Operating system

Window 10 (19045)

Last known working Electron Forge version

unkonw

Expected behavior

Preload js should wrap by webpack.

Actual behavior

Not do the expected behavior.

Steps to reproduce

      renderer: {
        config: rendererConfig,
        entryPoints: [
          {
            js: './src/main.ts',
            name: 'main',
            preload: {
              js: './electron/preload.js',
              config: {
                entry: "./electron/preload.js",
                output: {
                  path: path.resolve(__dirname, ".webpack/main"),
                  filename: '[name].js',
                },
                resolve: {
                  extensions: [".js"],
                }
              },
            },
          },
        ],
      },

I'm sure that main and renderer webpack output not clean up work directory.

Additional information

No response

seamory commented 1 year ago

Hello, is there any one who have the same problem?

euglv commented 1 month ago

Yes, I have the same problem. I need to have separate webpack configs for renderer and preload scripts. Renderer webpack config include frontend framework plugins, that are not needed in preload script.