Closed DarknessChaser closed 1 year ago
when i use monaco-editor v0.30.1, works fine
I have this problem,too
The issue seems to be related to webpack version.
In vue-cli v4.5.x,they use webpack 4. monaco-editor v0.31.1 not work.
In vue-cli v5.0.x,they use webpack 5. monaco-editor v0.31.1 work good.
Maybe monaco can provide a recommended webpack version? or prompt 0.31.1 version no longer supports vue-cli4
I have this problem,too
@KKKZOZ nihao!You might be able to try vue-cli 5.0.0. this works for me.
I have this problem,too
@KKKZOZ nihao (mean to hello in Chinese)!You might be able to try vue-cli 5.0.0. this works for me.
哈哈哈哈你好你好 我纠结这个问题好几天了,超级感谢!
I have this problem,too
@KKKZOZ nihao (mean to hello in Chinese)!You might be able to try vue-cli 5.0.0. this works for me.
哈哈哈哈你好你好 我纠结这个问题好几天了,超级感谢!
🌿
I have this problem,too
@KKKZOZ nihao (mean to hello in Chinese)!You might be able to try vue-cli 5.0.0. this works for me.
哈哈哈哈你好你好 我纠结这个问题好几天了,超级感谢!
🌿
Surprise!哈哈哈哈
Issue #2915 also relates to this.
react webpack4
# package.json
dependencies{
...
"react-monaco-editor": "0.46.0",
"monaco-editor": "0.30.1"
"monaco-editor-webpack-plugin": "6.0.0",
...
}
The same problem @vue/cli 4.5.15 webpack 5.65.0
"dependencies": {
"monaco-editor": "^0.32.1",
"monaco-editor-webpack-plugin": "^7.0.1",
...
}
同样的问题@vue/cli 4.5.15 webpack 5.65.0
"dependencies": { "monaco-editor": "^0.32.1", "monaco-editor-webpack-plugin": "^7.0.1", ... }
我也碰到同样问题了,vue-cli升级到5.0,也不行,你解决了么?
同样的问题@vue/cli 4.5.15 webpack 5.65.0
"dependencies": { "monaco-editor": "^0.32.1", "monaco-editor-webpack-plugin": "^7.0.1", ... }
我也碰到同样问题了,vue-cli升级到5.0,也不行,你解决了么?
这是我的相应配置,可以正常使用 This is my part of package.json file, it works fine for me!
"dependencies": {
"@types/sortablejs": "^1.10.7",
"core-js": "^3.8.3",
"element-plus": "^1.3.0-beta.7",
"monaco-editor": "^0.31.1",
"monaco-editor-webpack-plugin": "^7.0.1",
"sortablejs": "^1.14.0",
"vue": "^3.2.13",
"xterm": "^4.16.0"
},
相关版本 node version: v16.13.2 npm version: 8.1.2 @vue/cli 5.0.0-rc.2
同样的问题@vue/cli 4.5.15 webpack 5.65.0
"dependencies": { "monaco-editor": "^0.32.1", "monaco-editor-webpack-plugin": "^7.0.1", ... }
我也碰到同样问题了,vue-cli升级到5.0,也不行,你解决了么?
这是我的相应配置,可以正常使用 This is my part of package.json file, it works fine for me!
"dependencies": { "@types/sortablejs": "^1.10.7", "core-js": "^3.8.3", "element-plus": "^1.3.0-beta.7", "monaco-editor": "^0.31.1", "monaco-editor-webpack-plugin": "^7.0.1", "sortablejs": "^1.14.0", "vue": "^3.2.13", "xterm": "^4.16.0" },
相关版本 node version: v16.13.2 npm version: 8.1.2 @vue/cli 5.0.0-rc.2
谢谢,老工程vue/cli是4.5的,升级到5.0以后,包括你上面列举的这些包,都升级了还是不行,但是我测试了下直接用5.0版本的vue/cli创建的新工程接入monaco,是正常的,估计还有其他的包在影响,已经准备用新的工程文件+复制老代码处理了
同样的问题@vue/cli 4.5.15 webpack 5.65.0
"dependencies": { "monaco-editor": "^0.32.1", "monaco-editor-webpack-plugin": "^7.0.1", ... }
我也碰到同样问题了,vue-cli升级到5.0,也不行,你解决了么?
这是我的相应配置,可以正常使用 This is my part of package.json file, it works fine for me!
"dependencies": { "@types/sortablejs": "^1.10.7", "core-js": "^3.8.3", "element-plus": "^1.3.0-beta.7", "monaco-editor": "^0.31.1", "monaco-editor-webpack-plugin": "^7.0.1", "sortablejs": "^1.14.0", "vue": "^3.2.13", "xterm": "^4.16.0" },
相关版本 node version: v16.13.2 npm version: 8.1.2 @vue/cli 5.0.0-rc.2
谢谢,老工程vue/cli是4.5的,升级到5.0以后,包括你上面列举的这些包,都升级了还是不行,但是我测试了下直接用5.0版本的vue/cli创建的新工程接入monaco,是正常的,估计还有其他的包在影响,已经准备用新的工程文件+复制老代码处理了
我大概猜测是因为新版vue.config.js中的transpileDependencies: true 你试试手动打开?
降低版本也可以 "monaco-editor": "^0.30.1"
老vue 项目编译通过了, 降低 moncao 版本就可以编译了
"devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-service": "~4.5.0", "babel-plugin-component": "^1.1.1", "monaco-editor": "0.30.1", "monaco-editor-webpack-plugin": "6.0.0", "vue-template-compiler": "^2.6.11" },
monaco-editor-webpack-plugin 要用 7.0.1
{
test: /monaco-editor\/.*\.js/,
loader: "babel-loader"
}
Add babel loader for *.worker.js
and *.contribution.js
{ test: /monaco-editor\/.*\.js/, loader: "babel-loader" }
Add babel loader for
*.worker.js
and*.contribution.js
For those like me who aren't sure where to put this, I put it in the vue.config.js
const path = require("path");
module.exports = {
configureWebpack: {
plugins: [
new MonacoWebpackPlugin({
languages: ["python"],//configure your languages here
}), // Place it here
],
module:{
rules: [
{
test: /monaco-editor\/.*\.js/,
loader: "babel-loader"
}
]
}
}
};```
vuecli5.0.8 is no problem, however. 0.34.0 will have other problems, there is no problem below 0.33.0
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-router": "^5.0.8",
"@vue/cli-plugin-vuex": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"vue-template-compiler": "^2.6.14",
"monaco-editor": "^0.33.0",
"monaco-editor-esm-webpack-plugin": "^2.1.0",
"monaco-editor-nls": "^3.0.0",
"monaco-editor-webpack-plugin": "^7.0.1",
},
maybe you can try the solution here if you are using webpack 4
module.exports = {
// ...
module: {
rules: [
{
test: /monaco-editor[\\/].*\.js$/,
loader: "babel-loader",
},
],
},
}
I use vuecli@4.5.19 In vue.config.js I configured like this
module.exports = {
chainWebpack: (config) => {
config.module
.rule('monaco-editor-babel-loader')
.test(/monaco-editor[\\/].*\.js$/)
.end()
.use("babel-loader")
.loader("babel-loader")
.end()
}
}
+1
老vue 项目编译通过了, 降低 moncao 版本就可以编译了
"devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-service": "~4.5.0", "babel-plugin-component": "^1.1.1", "monaco-editor": "0.30.1", "monaco-editor-webpack-plugin": "6.0.0", "vue-template-compiler": "^2.6.11" },
this works for me, I downgraded versions of monaco-editor and monaco-editor-webpack-plugin in vue project, this works for me.
"monaco-editor": "0.30.1" "monaco-editor-webpack-plugin": "6.0.0"
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Code
No response
Actual Behavior
Expected Behavior
Load editor in div
Additional Context