Cannot find module ‘vs/editor/editor.worker‘

当遇到'Cannot find module 'vs/editor/editor.worker''错误时,通常是monaco-editor及其webpack插件版本不匹配导致的。解决方法是将monaco-editor-webpack-plugin和react-monaco-editor降级到特定版本,例如分别设置为4.0.0和0.40.0,这通常能确保编辑器正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果出现Cannot find module ‘vs/editor/editor.worker’,是由于monaco-editormonaco-editor-webpack-plugin版本出现问题,可以分别重新安装指定版本,可以修改为
“monaco-editor-webpack-plugin”: “4.0.0”,
"react-monaco-editor:“0.40.0”,
可以正常使用

vue使用monaco-editor的2.6.12版本报错Module parse failed: Invalid regular expression flag (5:19) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | * Licensed under the MIT License. See License.txt in the project root for license information. | *--------------------------------------------------------------------------------------------*/ > const markRegex = /\bMARK:\s*(.*)$/d; | const trimDashesRegex = /^-+|-+$/g; | /** @ ./node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js 19:0-61 253:15-33 @ ./node_modules/monaco-editor/esm/vs/editor/browser/services/editorWorkerService.js @ ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js @ ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js @ ./node_modules/monaco-editor/esm/vs/editor/editor.api.js @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/dataExploitation/components/JavaCode.vue?vue&type=script&lang=js @ ./src/views/dataExploitation/components/JavaCode.vue?vue&type=script&lang=js @ ./src/views/dataExploitation/components/JavaCode.vue @ ./src/views sync ^\.\/.*$ @ ./src/store/modules/permission.js @ ./src/store/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://192.168.18.236:80&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
05-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值