Skip to content
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

transpile bundles for ie support #3

Merged
merged 1 commit into from
Aug 2, 2019
Merged

Conversation

jpray
Copy link

@jpray jpray commented Jul 29, 2019

Tested on my VM and this seems to work ok. A couple notes:

  1. Currently this ES5 bundle is being served to all browsers. I usually create 2 separate bundles, one for modern browsers and one for IE11 and conditionally serve one or the other using something like https://github.com/muicss/loadjs . Let me know if you want me to setup an example of that too.

  2. The reason we are having to build the code with parcel and then run it through babel separately is that the Polymer team (Lit-Element) is only distributing their code as ES6 modules (no commonJS or AMD options). In addition, Parcel (and maybe webpack too) don't want to transpile anything within the node_modules directory as that would slow down the build quite a bit if they transpiled everything. Maybe webpack has already addressed this, note sure, but it should be available in Parcel in the future: babel transpile node_module dependencies parcel-bundler/parcel#1655

  3. Because we are transpiling the JS AFTER source maps were created, the source maps are almost certainly wrong, so you should disable JS source maps in the browser when debugging. : (

add polyfills

git ignore parcel's .cache directory
// setTimeout is to avoid browserSync throwing an error
// after the IE11 transpile is done
setTimeout(function() {
transpileForIE("dist");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you comment out this "transpileForIE" call in the dev task, you'll at least have accurate source maps while developing. Just won't be able to develop using IE.

@rhali786 rhali786 merged commit 13efd12 into rhali786:master Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants