-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
与monaco-editor-webpack-plugin冲突 #4034
Comments
请问问题解决了吗?我也有同样的问题 |
这是不是一个bug啊?请问 |
@wangchong19940101
|
如果线上CI构建,拉取包的时候会报错吗? |
umi 可能需要升级一下依赖 css-modules/postcss-modules-scope#1 ref #4229 |
在 umijs/umi#2236 跟进。 |
可以升级到 umi 2.8.0 以上,然配置上 cssLoaderVersion: 2。 |
这个可以在 export default {
cssLoaderVersion: 2,
... 来解决。 此外还需要配置 webpack: import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
@ -25,6 +26,12 @@ function getModulePackageName(module: { context: string }) {
}
export default (config: any) => {
config.plugin('monaco-editor').use(MonacoWebpackPlugin, [
{
// available options are documented at https://github.com/Microsoft/monaco-editor-webpack-plugin#options
languages: ['json', 'python']
}
]); 然后要安装 使用则是 import MonacoEditor from 'react-monaco-editor';
<MonacoEditor
width="800"
height="600"
language="python"
theme="vs-dark"
value={'xxx'}
options={{
selectOnLineNumbers: true,
}}
onChange={newCode => setExtractorCode(newCode)}
editorDidMount={editor => editor.focus()}
/> 但是 start 是可以 start, 启动后进入有 monaco editor 的页面还是会说: Unhandled Rejection (ReferenceError): __insane_exports is not defined
push../node_modules/monaco-editor/esm/vs/base/common/insane/insane.js.4../defaults
node_modules/monaco-editor/esm/vs/base/common/insane/insane.js:95
92 |
93 | insane.defaults = defaults;
94 | module.exports = insane;
> 95 | __insane_exports = insane;
| ^ 96 |
97 | }, { "./defaults": 2, "./parser": 7, "./sanitizer": 8, "assignment": 6, "he": 9 }], 5: [function (require, module, exports) {
98 | 'use strict'; |
@linonetwo microsoft/monaco-editor#1574 |
//plugin.config.js
经测试与2.3.0和2.3.1冲突,错误信息:
通过 umi create 命令创建antdpro不会出现该错误,该命令创建pro的版本
The text was updated successfully, but these errors were encountered: