使用 react-monaco-editor 生成构建时出现意外的令牌错误

Getting unexpected token error when generating build with react-monaco-editor

执行时出现以下错误 npm run build:

Child extract-text-webpack-plugin ../../node_modules/extract-text-webpack-plugin/dist ../../node_modules/css-loader/index.js??ref--2-1!../../node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css:
2 modules
Child vs/language/typescript/tsWorker:
 1 asset
  [17] (webpack)/buildin/global.js 509 bytes {0} [built]
  [40] (webpack)/buildin/harmony-module.js 596 bytes {0} [built]
    + 40 hidden modules

ERROR in ts.worker.js from UglifyJs
Unexpected token: name (_isWindows) [ts.worker.js:78,4]

webpack 配置:

https://github.com/react-monaco-editor/react-monaco-editor/files/6173508/webpack.zip

通过将 webpack 从版本 3 升级到版本 4 解决了问题。 这也需要升级多个插件,因为其中许多已弃用并在内部添加到 webpack 配置中