Skip to content
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

使用后多出上百个chunk文件 #5

Closed
zhenxianluo opened this issue Mar 20, 2019 · 8 comments
Closed

使用后多出上百个chunk文件 #5

zhenxianluo opened this issue Mar 20, 2019 · 8 comments

Comments

@zhenxianluo
Copy link

No description provided.

@zhenxianluo
Copy link
Author

webpack版本3.8.1

@jaywcjlove
Copy link
Member

@zhenxianluo 这个问题我无能为力,你应该检查你的 webpack 打包规则。看 https://uiwjs.github.io/react-codemirror/ 它只有 3 个 chunk。

@zhenxianluo
Copy link
Author

换成react-codemirror2已经好了, 谢谢

@luguosheng1314
Copy link

遇到同样的问题 用2.x版本也会这样

@jaywcjlove
Copy link
Member

@luguosheng1314 这个是他的语言包。没有将所有的语言合并。

@hua1995116
Copy link

代码中不应该 import(codemirror/mode/${mode.mode}/${mode.mode}.js) 这样引入,因为webpack 无法动态确定具体引入哪个 js,因此会把 mode 下的所有文件都打包进去,建议这个引入交给用户吧。 @jaywcjlove

jaywcjlove added a commit that referenced this issue May 12, 2021
@jaywcjlove
Copy link
Member

@hua1995116 我们这边的应用场景是,不确定要支持哪个语言,需要按需自动加载

@jaywcjlove
Copy link
Member

prismjs: {
test: /[\\/]node_modules[\\/](codemirror)[\\/]/,
name: 'codemirror-vendor',
chunks: 'async',
},

配置 webpack 减少 chunk 输出。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants