汉化
wabpack端需要额外引入 `monaco-editor-esm-webpack-plugin`,`monaco-editor-nls`,并且要在monaco之前,manaco要改成require的方式引入,不然右键菜单不生效。
import { setLocaleData } from "monaco-editor-nls";
import zh_CN from "monaco-editor-nls/locale/zh-hans";
setLocaleData(zh_CN);
// import * as monaco from "monaco-editor";
const monaco = require('monaco-editor/esm/vs/editor/editor.api');
各个依赖版本,package.json:
{
"dependencies": {
...
"monaco-editor": "0.30.1",
"monaco-editor-nls": "^2.0.0",
},
"devDependencies": {
...
"monaco-editor-esm-webpack-plugin": "^2.0.0",
"monaco-editor-webpack-plugin": "6.0.0"
},
}
loaders加载问题
新版本monaco-editor (编辑文字时最新的是0.31)会有 loaders的加载问题&#