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.

MonacoWebpackPlugin causing 'TypeError: Cannot set property 'chunkLoading' of undefined'

See original GitHub issue

I’m creating an Electron app using react-monaco-editor, Forge and Webpack 5. Using MonacoWebpackPlugin in Webpack config causes Forge to throw the following error:

$ yarn start
yarn run v1.22.10
$ cross-env NODE_ENV=development electron-forge start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies
✔ Compiling Main Process Code
✖ Launch Dev Servers

An unhandled error has occurred inside Forge:
Cannot set property 'chunkLoading' of undefined
TypeError: Cannot set property 'chunkLoading' of undefined
    at WebWorkerTemplatePlugin.apply (C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\webpack\lib\webworker\WebWorkerTemplatePlugin.js:20:40)
    at Compiler.createChildCompiler (C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\@electron-forge\plugin-webpack\node_modules\webpack\lib\Compiler.js:561:12)
    at Compilation.createChildCompiler (C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\@electron-forge\plugin-webpack\node_modules\webpack\lib\Compilation.js:2243:24)
    at C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\monaco-editor-webpack-plugin\out\plugins\AddWorkerEntryPointPlugin.js:17:43
    at AsyncParallelHook.eval [as callAsync] (eval at create (C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:25:1)
    at AsyncParallelHook.lazyCompileHook (C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Users\XXX\Desktop\8BitSimulatorV2\node_modules\@electron-forge\plugin-webpack\node_modules\webpack\lib\Compiler.js:669:20
SimulatorV2\node_modules\@electron-forge\plugin-webpack\node_modules\webpack\lib\Compiler.js:529:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here’s a VERY minimal reproducible example (using npm) And here’s a bit less minimal reproducible example (using yarn)

  • OS: Windows
  • Env: Electron
  • Node version: 15.14.0
  • monaco-editor-webpack-plugin version: 3.0.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

5reactions
iamaseemcommented, Apr 19, 2021

Facing same issue with nextjs

0reactions
mac501plcommented, May 13, 2021

This might very well be the case, apparently Forge doesn’t support Webpack 5’s definePlugin. Downgrading to Webpack 4 solves the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack 5 bundled code not working: Uncaught TypeError ...
Uncaught TypeError: Cannot set property 'webpackHotUpdate_<myAppName>' of undefined at jsonp chunk loading:78.
Read more >
monaco-editor-webpack-plugin - npm
A webpack plugin for the Monaco Editor. Latest version: 7.0.1, last published: a year ago. Start using monaco-editor-webpack-plugin in your ...
Read more >
TypeError: Cannot set property 'apex' of undefined #167
you need to set up the MonacoWebpackPlugin , I put mine in vue.config.js const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); module.exports ...
Read more >
Webpack 5 release (2020-10-10)
JSON modules now align with the proposal and emit a warning when a non-default export is used. JSON modules no longer have named...
Read more >
cannot set property - RPG Maker Forums
RMMV "Cannot set property 'opacity' of undefined" when transforming an enemy. Hello! I just found a problem that probably requires changing ...
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