ilhan007 / rollup-wc

UI5 Web Components + Rollup starter
5 stars 0 forks source link

Where is bundle.esm.js coming from? #2

Open aurora opened 4 years ago

aurora commented 4 years ago

I stumbled over your repository when searching for a way of how to use ui5 components without any of the supported frameworks. However, i wonder where the file src/bundle.esm.js is coming from; is it hand-crafted or auto-generated?

Is it generally safe to auto-generate bundle.esm.js from the corresponding ui5 module directories in node_modules?

ilhan007 commented 4 years ago

Hello @aurora

The src/bundle.esm.js is the file you import whatever components you need in your application, it might consists of just the Button import and nothing else. It serves as input file for the "rollup" build tool (in this case) to process imports and to create a JS file, that can be loaded as script in a HTML page ("/dist/bundle.esm.js")

So, this one is created by hand, but I guess it can be auto-generated.

If by generating the src/bundle.esm.js file from the corresponding ui5 module directories in node_modules you mean to scan node_modules/@ui5/webcomponents/dist directory and for each component you find to make an import and create that file, why not.

But the purpose is to have the things you use in the app bundled, that is why, importing all that we have in node_modules in not recommended for productive scenarios.

aurora commented 4 years ago

I see - thanks for your fast reply!