Inefficient bundling detected? #2562
-
I use snowpack to install my SAPUI5 modules, for example in my package.json I have:
But am getting a lot of these in the browser console, when I run my app :
How do I get rid of such warnings? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
You should use a plugin that makes URLs out of JSON imports instead of inlining them. Every bundler should support both options, unfortunately some use inlining which is not a good default for our use case. This plugin should do the right thing for snowpack in the config, put Make sure to check the network tab before and after to see why the warnings are there - bundle should be much smaller. |
Beta Was this translation helpful? Give feedback.
-
Hello @hrstoyanov in addition to the answer by @pskelin above |
Beta Was this translation helpful? Give feedback.
-
@pskelin @ilhan007
Then deleted and rebuilt the modules:
|
Beta Was this translation helpful? Give feedback.
-
I tried an example with the plugin and didn't get it to work as it was throwing some exceptions. When reading the snowpack documentation, it seems showpack itself always inlines JSON files and this is not configurable: Even though snowpack can create URL references to other asset types: I would suggest to open a feature request in the snowpack project to support converting JSON imports to URL references. Alternatively, you can try out rollup as your build and development tool. It is very mature, feature rich and fast. Here is a sample configuration project showing how to use it with ui5 webcomponents: |
Beta Was this translation helpful? Give feedback.
You should use a plugin that makes URLs out of JSON imports instead of inlining them. Every bundler should support both options, unfortunately some use inlining which is not a good default for our use case.
This plugin should do the right thing for snowpack
https://www.npmjs.com/package/snowpack-plugin-url-loader
in the config, put
json
in the extensions you want loaded as URLs, and setlimit
to 0 (so they are never inlined).Make sure to check the network tab before and after to see why the warnings are there - bundle should be much smaller.