Electron-forge: Webpack template: index.css file missing when packaged

Created on 15 Jul 2019  Â·  9Comments  Â·  Source: electron-userland/electron-forge

  • [✓] I have read the contribution documentation for this project.
  • [✓] I agree to follow the code of conduct that this project follows, as appropriate.
  • [✓] I have searched the issue tracker for an issue that matches the one I want to file, without success.

I updated to @electron-forge/plugin-webpack-6.0.0-beta.41 and build does not work anymore. It is reproducible just by trying this out on the webpack template. Steps to reproduce below. Everything runs without errors or warnings.

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

This is the package output:

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:async-ora Process Started: Checking your system +0ms
  electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this +0ms
  electron-forge:async-ora Process Succeeded: Checking your system -- after 349ms +350ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:async-ora Process Started: Preparing to Package Application for arch: x64 +0ms
  electron-forge:project-resolver searching for project in: /var/tmp/my-new-app +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /var/tmp/my-new-app/package.json +2ms
  electron-forge:require-search searching [ '@electron-forge/plugin-webpack',
  '/var/tmp/my-new-app/@electron-forge/plugin-webpack',
  '/var/tmp/my-new-app/node_modules/@electron-forge/plugin-webpack' ] relative to /var/tmp/my-new-app +0ms
  electron-forge:require-search testing @electron-forge/plugin-webpack +1ms
  electron-forge:plugin:webpack hooking process events +0ms
  electron-forge:async-ora Process Started: Compiling Main Process Code +389ms
  electron-forge:async-ora Process Succeeded: Compiling Main Process Code -- after 649ms +659ms
  electron-forge:async-ora Process Started: Compiling Renderer Template +0ms
  electron-forge:async-ora Process Succeeded: Compiling Renderer Template -- after 294ms +294ms
  electron-forge:packager packaging with options { asar: false,
  overwrite: true,
  ignore: [Function],
  dir: '/var/tmp/my-new-app',
  arch: 'x64',
  platform: 'linux',
  afterCopy: [ [Function] ],
  afterExtract: [ [Function] ],
  afterPrune: [ [Function] ],
  out: '/var/tmp/my-new-app/out',
  electronVersion: '5.0.6',
  quiet: true } +0ms
  electron-forge:async-ora Process Succeeded: Preparing to Package Application for arch: x64 -- after 2.8s +1s
  electron-forge:async-ora Process Started: Preparing native dependencies +1ms
  electron-forge:async-ora Process Succeeded: Preparing native dependencies -- after 4ms +4ms
  electron-forge:async-ora Process Started: Packaging Application +0ms
  electron-forge:async-ora Process Succeeded: Packaging Application -- after 187ms +187ms
  electron-forge:plugin:webpack handling process exit with: { cleanup: true } +3s

What does your config.forge data in package.json look like?

{
  "packagerConfig": {},
  "makers": [
    {
      "name": "@electron-forge/maker-squirrel",
      "config": {
        "name": "my_new_app"
      }
    },
    {
      "name": "@electron-forge/maker-zip",
      "platforms": [
        "darwin"
      ]
    },
    {
      "name": "@electron-forge/maker-deb",
      "config": {}
    },
    {
      "name": "@electron-forge/maker-rpm",
      "config": {}
    }
  ],
  "plugins": [
    [
      "@electron-forge/plugin-webpack",
      {
        "mainConfig": "./webpack.main.config.js",
        "renderer": {
          "config": "./webpack.renderer.config.js",
          "entryPoints": [
            {
              "html": "./src/index.html",
              "js": "./src/renderer.js",
              "name": "main_window"
            }
          ]
        }
      }
    ]
  ]
}

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-forge init is a good starting point, if that is not the
source of your problem.

npx create-electron-app my-new-app --template=webpack
cd my-new-app/
npm run package
./out/my-new-app-linux-x64/my-new-app

Snímek z 2019-07-15 16-40-50

Bug

All 9 comments

I tried to solve this by downgrading:

  • 6.0.0.beta-40: The issue exists
  • 6.0.0.beta-39: It works ✓
  • the index.js reference will be fixed in #1021.
  • the index.css reference will be fixed in #1031 _(although you can just remove the <link> from index.html)_.

The issue still exists in beta 41 (as described on #1032):

{ 
    "@electron-forge/cli": "6.0.0-beta.41",
    "@electron-forge/maker-deb": "6.0.0-beta.41",
    "@electron-forge/maker-rpm": "6.0.0-beta.41",
    "@electron-forge/maker-squirrel": "6.0.0-beta.41",
    "@electron-forge/maker-zip": "6.0.0-beta.41",
    "@electron-forge/plugin-webpack": "6.0.0-beta.41",
}

Also, downgrading to beta 39 did not solve the issue, where the same happens.

The dependencies are the following:

  "dependencies": {
    "electron-squirrel-startup": "^1.0.0"
  },
  "devDependencies": {
    "@electron-forge/cli": "6.0.0-beta.39",
    "@electron-forge/maker-deb": "6.0.0-beta.39",
    "@electron-forge/maker-rpm": "6.0.0-beta.39",
    "@electron-forge/maker-squirrel": "6.0.0-beta.39",
    "@electron-forge/maker-zip": "6.0.0-beta.39",
    "@electron-forge/plugin-webpack": "6.0.0-beta.39",
    "@marshallofsound/webpack-asset-relocator-loader": "^0.5.0",
    "electron": "5.0.6",
    "file-loader": "^4.0.0",
    "node-loader": "^0.6.0",
    "style-loader": "^0.23.1"
  }

Beta 39 had the index.js issue but not the CSS file issue (as there was no CSS file).

Please be patient, I'm trying to release a new version as fast as possible.

No worries, I just wanted to register that. I've already made a rewrite on my app so it can build without Webpack.

This has been fixed in beta 42.

@malept, thank you for your work, I really did not expect this to be looked at so quickly.

I tried my initial approach this morning again with beta 42, but I'm still having the same trouble with index.js file, however, the index.css no longer appears in the console as 404, well, perhaps because there is no css in the initial example anymore. Could you please take a look again?

This is the reproduction steps:

npx create-electron-app my-new-app --template=webpack
cd my-new-app/
npm run package
./out/my-new-app-linux-x64/my-new-app

Snímek z 2019-07-16 11-05-53
Snímek z 2019-07-16 11-06-17

Hi all,

Same problem here with index.js getting 404

Version: 6.0.0-beta.42

The index.js problem is confirmed and being tracked in https://github.com/electron-userland/electron-forge/issues/1034, please do not use this issue anymore.

Was this page helpful?
0 / 5 - 0 ratings