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

IE 11 support? #4

Closed
brownieboy opened this issue Sep 5, 2018 · 6 comments · Fixed by #33
Closed

IE 11 support? #4

brownieboy opened this issue Sep 5, 2018 · 6 comments · Fixed by #33

Comments

@brownieboy
Copy link

brownieboy commented Sep 5, 2018

I couldn't get it to work at all with IE 11. Is it supported? (The readme does say "all browsers", and IE 11 is still supported.)

@brownieboy brownieboy reopened this Sep 5, 2018
@lazyhero
Copy link

lazyhero commented Sep 5, 2018

same question

@jdhollander
Copy link

Having tried the demos in IE11, it doesn't work.

I get an exception "Object doesn't support this action". In the source it's at src/index.ts line 11:
load(new URL(scr.getAttribute('data-main'), document.baseURI));

IE doesn't support the URL constructor. https://developer.mozilla.org/en-US/docs/Web/API/URL/URL

@webschik
Copy link

webschik commented Sep 5, 2018

There are several problems:

  1. Fetch API, URL, Promise are not supported in IE 11. So, to run the demos/static-imports locally I've injected there
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=default,fetch"></script>
  1. Transform produces unsupported code (e.g. template strings).

Check the demo demos/static-imports and shimport/src/load.ts:27.

// transform(text, url) returns

__shimport__.define('http://localhost:5000/static-imports/main.js', ['./a.js', './b.js'], function(__import, __exports, a, __dep_1){

a = a.default; 
/*import a from './a.js'*/;
var message = __dep_1.message;
/*import { message } from './b.js'*/;

document.body.innerHTML += `\n\t<p>${a}</p>\n\t<p>${message}</p>\n`;
});
//# sourceURL=http://localhost:5000/static-imports/main.js"

@Rich-Harris, what do you think? Should we fix the transform function or it's better to use transform + Babel?

Solution to run the demo/static-imports in IE 11

  1. Inject polyfills to demos/static-imports/index.html:
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=default,fetch"></script>
  1. Remove template strings from demos/static-imports/main.js:
import a from './a.js';
import { message } from './b.js';

document.body.innerHTML += '<p>' + a + '</p><p>' + message + '</p>';

@Rich-Harris
Copy link
Owner

Yeah, it's a bring-your-own-polyfill deal, and you would need to be serving modules that have been transpiled to ES5 (apart from import/export). As long as you're doing that, it works great in IE11. I'll make this clearer in the docs when I'm less busy

@dimensi
Copy link

dimensi commented May 27, 2019

@Rich-Harris any news ?

@Conduitry
Copy link
Collaborator

The readme now has a note about what exactly this library does for you and what it needs to do that.

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 a pull request may close this issue.

7 participants