0

I am using custom compression for my assets and would like to use some modern web bundler (webpack, rollup, parcel, etc.) I am implementing both server side and client side, but I couldn't find how to implement runtime transformation when fetching assets in any of those projects.

Is there a simple way to do it in one of those projects or maybe some other tool for this?

(simple = part of the project's design, not some service-workers' hack)

  • As there are plugins that support including vue, svelte, react, ts, ... in those bundlers, which all need to be processed, it should be possible to do so. – t.niese Dec 26 '19 at 09:41
  • from what I saw they do it in build-time, when producing the bundle (e.g. webpack loaders) – yannay livneh Dec 26 '19 at 10:02
  • The plugins take the _"assets"_ associated with them and based on the plugin do something with those assets in the building step, in case of ts, vue, ... it is parsing and build time transformation. But you can generate any code you want for your assets, that can be a runtime loader that loader resources from the server, it can be a runtime decompression, that decompress compressed assets that are bundled, ... – t.niese Dec 26 '19 at 10:14
  • Can you link to a specific example? I didn't see anything useful – yannay livneh Dec 26 '19 at 10:52
  • Sorry I don't have any, I just know it is possible, and I haven't used them for a while so I can't come up with an answer pointing to the relevant parts. – t.niese Dec 26 '19 at 10:54

1 Answers1

0

RollupJS has dynamicImportFunction option and an example for import polyfill which is what I was looking for