Skip to content

electron/index.js bundled since [email protected] #11599

@MayaRainer

Description

@MayaRainer

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions