alibaba / ice

🚀 ice.js: The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
https://ice.work
MIT License
17.84k stars 2.09k forks source link

关于新插件引入说明模糊的问题,无法成功引入monaco-editor-webpack-plugin #4954

Open jumpingFinger opened 2 years ago

jumpingFinger commented 2 years ago

3种写法都无法成功把对应的语言主题包引入项目

image

希望可以给个相关写法转换的说明,webpack.config.js文件写法只有一行代码

new MonacoWebpackPlugin(['java'])

环境

"@ali/build-plugin-ice-def": "^0.1.0",
"@iceworks/spec": "^1.0.0",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"build-plugin-antd": "^0.1.4",
"build-plugin-fusion": "^0.1.18",
"build-plugin-ignore-style": "^0.1.0",
"build-plugin-moment-locales": "^0.1.0",
"eslint": "^7.30.0",
"ice.js": "^2.0.0",
"monaco-editor": "^0.30.1",
"monaco-editor-webpack-plugin": "^6.0.0",
"stylelint": "^13.2.0"
imsobear commented 2 years ago

https://ice.work/docs/config/about/#webpackplugins @jumpingFinger 这个不行吗?

jumpingFinger commented 2 years ago

https://ice.work/docs/config/about/#webpackplugins @jumpingFinger 这个不行吗?

webpakcplugins 直接配置会报错

ClarkXia commented 2 years ago

build.json 的方式:

{
  "webpackPlugins": {
    "monaco-editor-webpack-plugin": {
      "options": ["java"]
    }
  }
}

插件的方式:

// local-plugin.js
module.exports = ({ onGetWebpackConfig }) => {
  onGetWebpackConfig((config) => {
    config.plugin('monaco-editor-webpack-plugin').use(require('monaco-editor-webpack-plugin'), [["java"]])
  });
}

插件的方式确保自定义插件正确在 build.json 中引入:

{
  "plugins": ["./local-plugin.js"]
}
jumpingFinger commented 2 years ago

嗯,两种方式都试过了。但主题就是引不进来,已经通过cdn搞了,感谢

gdc1998 commented 2 years ago

遇见了同样的问题 方便问下具体怎么解决的吗

linshaoye commented 1 year ago

@jumpingFinger 如果通过cdn 引入的 可以分析一下吗