-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish a build in ES6 module format #467
Comments
Can you send a PR to make this happen? I'll review it and merge if you do, but we have other priorities right now and we can't commit to this in the near future. |
Hrm, seems like Webpack does not export to ES6 modules yet. I didn't submit a PR, as I don't have a clean solution, but this work for me - by creating rollup.config.js with
and then running |
That's pretty cool. We were thinking about trying rollup with our codebase to see if we get a bit of size reduction and better tree-shaking. The extra bundle is also nice. Do you think you can add a PR with rollup having both es5 and es6 bundles? That'd be amazing. |
I don't know Rollup much, but I'll give it a try some time later this week! However, it might not be as straightforward as I hope - I tried building it from /src/ folder, but ran into issues with native Node.js modules being used. The sample config above just wraps the already webpack'd module. |
Welp, I give up. After spending a few more hours on it, I ended up with a 949kiB unminified monster, but after after switching the order of rollup plugins I got it back to reasonable 284kiB (still, 17kiB bigger than official build). I don't have the strength to finish it properly, since I don't know what current WebPack setup is doing, and also Rollup plugin documentation right now leaves a lot to be desired. Either way, neither of the builds was usable no matter how much I shuffled the plugin order and configuration. (Halfway through it left a bunch of lines like Here is my current state:
rollup.config.js:
I hope someone brave will have more success though :) For now, I'll use the es-module-wrapped webpack build for myself, so as far as that goes, this ticket can be closed. |
Thanks for the effort! I'll get back to this issue when we evaluate rollup. 🎉 |
Hi and thanks for the contributions to the JWT ecosystem.
I'm working on a project that targets only modern browsers (or, well, as of time of writing, bleeding edge features), and I would like to include your library as an ES6 module, e.g. putting something this in my html file:
<script type='module' src='vendor/auth0.min.module.js'></script>
Using Angular 4, Auth0 8.8.0, when I require the file either from your CDN, or from the npm package's build folder, if I try to include the minified file now, I get an error along the lines of "k is undefined".
To enable modules in browsers, for Firefox 54+ - go to about:config and set dom.moduleScripts.enabled to true. Using Chrome 60+ - go to chrome://flags and enable Experimental Web Platform features.
I might provide a sample later, but I suspect the issue can be solved by just configuring your build process to run webpack and create an ES6 module as a target? (I don't have experience with WebPack sadly.) Thanks!
The text was updated successfully, but these errors were encountered: