-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Improve Bundle Chunking #3
Comments
I might be reading this incorrectly, but it looks like you hardcode the loading of all languages from prism. It would be nice to be able to pair this down, perhaps by using the prism webpack plugin in the client app and defining the languages as props. |
@kyeotic These small JS files are loaded when used, and do not affect the size of the packaged JS. My application scenario cannot determine which languages to load. |
@jaywcjlove Yes, but the bundles are still present in the deployment, and they still add considerable noise to the build and source-map-explorer report. It would be nice if we could whitelist languages so that applications that did know which languages it supported could keep the rest from being bundled. This would be valuable even if the default was to bundle them all. |
@kyeotic This requires writing a webpack plugin. This needs to be studied. |
@kyeotic We need a plugin like monaco-editor-webpack-plugin |
I'm actually having a lot of trouble getting the prism webpack plugin to do anything. I tried forking this repo and trimming down the languages, then built with the prism plugin on the lib. I even added the plugin to the app that installed the editor, so that it was running in both places. I get 370+ bundles, which is smaller but not by half as many languages as I removed. |
@kyeotic thx! this good idea. I will deal with it when I have time. @uiwjs/react-markdown-preview |
is there any possible solution without ejecting create-react-app? |
@ppascualv https://github.com/kktjs/kkt Override create-react-app webpack configs without ejecting |
Is there any solution for this issue or any workaround without ejecting the app? I was taking a look at your library but I'm not sure how can it solve the issue. |
@ppascualv Dynamic import is used. Unable to split chunks it. https://v4.webpack.js.org/plugins/split-chunks-plugin/#split-chunks-example-1
|
it's not work
|
Lines 41 to 45 in 34f61a3
|
how to use it |
@guoseven Modify webpack configuration. https://webpack.js.org/configuration/optimization/#optimizationsplitchunks |
When bundled with create-react-app default settings this library produces over 400 chunked bundles. They are invidually all small, but total almost 1mb. I don't know what they all are, and they don't all appear to be loaded, but it is quite strange.
It looks like they are mostly from prism. I'm guessing they are individual language highlighting packs. Perhaps there is a way to skip them?
This tool is beautiful by the way, thank you for making it. This is easily the nicest markdown editor I've come across
The text was updated successfully, but these errors were encountered: