Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Is it possible to bundle UMD format libraries and ES6 modules with rollup-plugin-commonjs? #547
I downloaded these i18next minified js files, put them into a 'vendors' folder, here is my rollup config:
In my es6 files(localization.js):
Error message returned by
I searched for plugins to convert umd format js to es6 module format but haven't found anything available. What should I do to enable rollup to bundle UMD format third party library with other ES6 modules? or is it not supported in any way?
@TrySound I did try to install these packages via npm, but the error message is the same saying: 'XXX does not export default...'. Is there any plugin or rollup config missing? Below is the npm approach setting:
I installed packages via npm, here is the npm approach config:
In localization es6 js:
Perhaps the error is caused by rollup-plugin-commonjs? Or is it because the way I import the i18next module is not supported on the condition that I am trying to bundle UMD with ES6, and convert them into a AMD bundle? I haven't found any useful/applicable threads on SO or Github about this kind of scenario.
Would really appreciate any help or suggestion, Thanks.
Thanks for your quick responses.
I reinstalled i18next related packages on the same level of entry.js, and handle these packages as @TrySound suggested. This time rollup worked.
However, when bundled js file got loaded in browser, there was an error message from
I found that
I am not sure if this is caused by the library itself, or rollup-plugin-node-resolve, or rollup-plugin-commonjs, other packages(i18next, jquery-i18next doesn't have this problem) though. I'll open an issue for i18next-xhr-bacckend as well.
Thanks for your responses, they helped a lot.