Skip to content

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

Closed

Description

@mac501pl

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

Activity

  1. changed the title [-]MonacoWebpackPlugin causing errors[/-] [+]MonacoWebpackPlugin causing 'TypeError: Cannot set property 'chunkLoading' of undefined'[/+] on Apr 11, 2021
  2. iamaseem commented on Apr 19, 2021

    @iamaseem

    Facing same issue with nextjs

  3. dgrechka commented on Apr 23, 2021

    @dgrechka

    The same for me. the same issue.

  4. dgrechka commented on Apr 23, 2021

    @dgrechka

    Downgrading back to explicit version "monaco-editor-webpack-plugin": "3.0.0" helped, the issue has gone.
    That can be a workaround for others.

  5. mac501pl commented on Apr 24, 2021

    @mac501pl
    Author

    Downgrading didn't work for me

  6. delagen commented on May 13, 2021

    @delagen

    May be also related to Webpack 5?

  7. mac501pl commented on May 13, 2021

    @mac501pl
    Author

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

  8. locked and limited conversation to collaborators on Mar 8, 2023
  9. converted this issue into a discussion #3765 on Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssues identified as good community contribution opportunitieswebpack-plugin

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions