Parcel: Efficient IE11 support

Created on 10 Apr 2018  Â·  4Comments  Â·  Source: parcel-bundler/parcel

IE 11 will continue to be supported by Microsoft for several years, and people tell me that I have to support IE 11. However, I write code in ES2015, so I am going to have to transpile it to es5 and bundle it with all the necessary polyfills for older browsers. But I don't want modern browsers to have to load the huge bundle. I don't think I am alone in wanting that.

I would like

All 4 comments

I think this is more of an RFC and doesn't have much to do with IE11. If I understand correctly what you want is to target both old browsers and new ones supporting ES6 modules?

How should we handle imports to non-js modules, like CSS? Should we generate intermediary modules for it? How should handle CommonJS (require, exports)? Example :

  • main.js
import {foo} from './bar'

console.log('Foo', foo)
  • foo.jsx
import React from 'react'
import {fooClass} from './index.css'

module.exports.foo = <h2 className={fooClass}bar</h2>
  • foo.css
.fooClass {
  background: url('./asset.png')
}

That said I think this is an extremely cool feature to have.

Sounds like #41?

I was aiming for something a little more specific than #41.
What I wanted to suggest here is that parcel could by default produce legacy/modern bundles.

One problem I've experienced with this strategy is handling non-strict mode dependencies. Normally when bundling, strict mode can be individually applied to dependencies.

However, scripts loaded with <script type="module"> are interpreted as ES modules, which are automatically run with strict mode, with no way to opt out. Therefore, one constraint with this strategy is the entire bundled codebase must be strict mode (which is hardly a given with many CommonJS dependencies).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

466023746 picture 466023746  Â·  3Comments

algebraic-brain picture algebraic-brain  Â·  3Comments

termhn picture termhn  Â·  3Comments

davidnagli picture davidnagli  Â·  3Comments

jzimmek picture jzimmek  Â·  3Comments