Soo i’m transitioning to Rollup from Webpack, in webpack i had 3 entries, pollyfils.ts, vendor.ts, and app.ts, so webpack did ok in dealing with the pollyfils file, then in html i just include the script tag for pollyfils.bundle.js and all green.
However in Rollup i didn’t find a way to make multiple entries, and the multiEntry plugin only extends to globbing and still bundles to the same file.
So i tried importing my pollyfils in top of my app.module.ts file but it get’s errors, here are first the intl one, then the web-animations-js one (after i commented out intl):
Uncaught ReferenceError: IntlPolyfill is not defined
Okay, so you’re including the polyfills file into the app.module.ts. I think that is a good approach. Next step sounds like it is figuring out what’s going on with the polyfill not bundling correctly.
Chart.js and any javascript dependencies ideally can be imported into the app directly via npm and then imported into a .ts file. See the docs here.
Your best bet for font-awesome is to put the font files in a directory like assets/fonts. They’ll then be available in the www directory when the bundling process completes.
I think for font-awesome i’ll use the rollup copy plugin directly from npm to the www/assets directory, as for Chart.js i used the ProvidePlugin because it presented problems for me when just importing in the vendor.ts file when using webpack, thus i fixed using the ProvidePlugin so that those libs end up like a global import for webpack.
Tough in Rollup nothing like that exists i’ll have to try again with simple import and see what happens, however shouldn’t i be importing those in the top of the main.ts file or something like that?
So @danbucholtz i’m still reluctant to use the script tag way for those pollyfil, have you found anything about why rollup won’t play nice with them?
The current error in console makes me think web-animations-js issues are with minification, it states:
[14:23:20] rollup: Use of `eval` (in /home/carlos/Carlos/OSGroup/startApp/node_modules/web-animations-js/web-animations.min.js) is strongly discouraged, as it poses security risks and may cause issues with minification. See https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval for more details
@zakton5 Dude, i’m sorry to tell you this but… intl is a pollyfil, not an ES6 module.
It’s not like Rollup isn’t ready for the world, is the world the one that isn’t ready for Rollup, Rollup is based in the premise of three shaking ES6 modules, however most of the useful libs aren’t ES6 modules yet, most of them are in CommonJS format, though CommonJS plugins exists for Rollup, it’s very likely that it will have issues with that lib.
So basically your best bet with the pollyfils is to use the ionic configs for ionic-app-scripts to copy the pollyfil into the output folder and include it in your index.html as an script tag.
Yeah I knew it was a polyfill, but it used to be simple to import it and it was good to go. Thanks for the suggestion though. I’ve had to do the copying thing with multiple libraries now, so yeah, I guess I’ll just add another one lol thanks.