Skip to content

Setting "target: node" in demo app causes packaged app to fail to load index.js #3120

@petertorelli

Description

@petertorelli

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.4

Electron version

v22.0.0

Operating system

macOS 13.1 m1

Last known working Electron Forge version

6.0.0-beta.67

Expected behavior

The demo app should be able to load the renderer's index.js file.

Actual behavior

It does not, I get ERR_FILE_NOT_FOUND. See below.

Steps to reproduce

Start with the demo app:

yarn create electron-app my-new-app2 --template=webpack-typescript

Edit webpack.renderer.config.ts and add one line target: node, like this:

.
.
.
export const rendererConfig: Configuration = {
  module: {
    rules,
  },
  plugins,
  resolve: {
    extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'],
  },
  target: 'node',
};

Package and run

% yarn package
% open out/my-new-app2-darwin-arm64/my-new-app2.app

I expect the packaged application to be able to load index.js. Instead, it fails with ERR_FILE_NOT_FOUND because it is looking for Request URL: file:///Users/petertorelli/proj/my-new-app2/out/my-new-app2-darwin-arm64/my-new-app2.app/Contents/Resources/app/.webpack/renderer/main_window/main_window/index.js

image

As you can see 'main_window/main_window' is not a valid path:

% tree out/my-new-app2-darwin-arm64/my-new-app2.app/Contents/Resources/app/.webpack 
out/my-new-app2-darwin-arm64/my-new-app2.app/Contents/Resources/app/.webpack
├── main
│   └── index.js
└── renderer
    └── main_window
        ├── index.html
        ├── index.js
        └── preload.js

Additional information

EDIT: It was packaging fine in 6.0.0-beta.67 as seen in my other open issue #2949.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions