question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack template has not been updated to the new plugins syntax

See original GitHub issue

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.0-beta.68

Electron version

v21.2.0

Operating system

Windows 10

Last known working Electron Forge version

No response

Expected behavior

npm start should launch the application

Actual behavior

Getting error:

An unhandled rejection has occurred inside Forge: Error: Expected plugin to either be a plugin instance or a { name, config } object but found @electron-forge/plugin-webpack,[object Object]

Electron Forge was terminated. Location: {}

image

Steps to reproduce

I am trying to create a fresh TypeScript + Webpack application using electron-forge

Go to https://www.electronforge.io/templates/typescript-+-webpack-template

Copy the command to create new project: npx create-electron-app my-new-app --template=typescript-webpack

Without changing any code run the application using npm start

Additional information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
MarshallOfSoundcommented, Oct 27, 2022

@raphael10-collab per the comment above you need to change this syntax.

"plugins": [
  [
    "@electron-forge/plugin-webpack",
    { ... }
  ]
]

into this syntax

"plugins": [
  {
    "name": "@electron-forge/plugin-webpack",
    "config": { ... }
  }
]

@rinqtmith the fix has not been published yet, we’re aiming to get that out tomorrow PST

1reaction
rinqtmithcommented, Oct 27, 2022

I think it is not fixed in #2990. I tried a new project and it still makes old version package.json .

You need to pass an object {name, config} to plugins. For example,

 "plugins": [
        {
          "name": "@electron-forge/plugin-webpack",
          "config": {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "html": "./src/index.html",
                  "js": "./src/renderer.ts",
                  "name": "main_window",
                  "preload": {
                    "js": "./src/preload.ts"
                  }
                }
              ]
            }
          }
        }
      ]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack doesn't recompile in watch mode when a partial ...
In html-webpack-plugin the main.html file will recompile when changed. ... by adding the template file to the compilation dependencies. ... New issue. Have...
Read more >
Error using partials with HTML Webpack Plugin - Stack Overflow
EDIT. (EDIT: 2017-12-20 move "loaders" to "rules"). By default, "html-webpack-plugin" parses the template as "underscore" (also called ...
Read more >
HtmlWebpackPlugin | webpack
You can either let the plugin generate an HTML file for you, supply your own template using lodash templates, or use your own...
Read more >
html-webpack-plugin - npm
The template can also be directly inlined directly into the options object. ⚠️ templateContent does not allow to use webpack loaders for your ......
Read more >
How I solved and debugged my Webpack issue through trial ...
I knew that Webpack was not easy to configure: there are many parts with ... new HtmlWebpackPlugin({ inject: false, hash: true, template: '....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found