Bug report
What is the current behavior?
Since version 5.0.0-beta.30, webpack bundles the electron/index.js file when using require('electron') with target electron-main. This causes it to fail, as that file uses __dirname to refer to other files in its directory.
If the current behavior is a bug, please provide the steps to reproduce.
webpack.config.js
module.exports = {
entry: './main.js',
output: {path: __dirname + '/app', filename: 'main.js'},
target: 'electron-main',
};
main.js
const {app} = require('electron');
What is the expected behavior?
electron is properly require-d as an external dependency, not bundled. This worked up until and including 5.0.0-beta.29.
Other relevant information:
webpack version: 5.0.0-rc.4
Node.js version: 12.14.0
Operating System: Windows 10
Additional tools: Electron
Bug report
What is the current behavior?
Since version 5.0.0-beta.30, webpack bundles the
electron/index.jsfile when usingrequire('electron')with targetelectron-main. This causes it to fail, as that file uses__dirnameto refer to other files in its directory.If the current behavior is a bug, please provide the steps to reproduce.
webpack.config.js
main.js
What is the expected behavior?
electronis properlyrequire-d as an external dependency, not bundled. This worked up until and including 5.0.0-beta.29.Other relevant information:
webpack version: 5.0.0-rc.4
Node.js version: 12.14.0
Operating System: Windows 10
Additional tools: Electron