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

IE9 and export default with ES5 compile target #4145

Closed
KnisterPeter opened this issue Aug 4, 2015 · 11 comments
Closed

IE9 and export default with ES5 compile target #4145

KnisterPeter opened this issue Aug 4, 2015 · 11 comments
Labels
Duplicate An existing issue was already created

Comments

@KnisterPeter
Copy link
Contributor

Hello,

we are using TS 1.5 and have a compile target set to ES5.
Now there is an issue with IE9 and the default keyword. Is there a way to get around this via a compiler flag? Or is this just a bug because in IE9 'default' is a reserved word?

@KnisterPeter
Copy link
Contributor Author

Sorry, this is not a TS problem.

@KnisterPeter
Copy link
Contributor Author

While digging deeper, this finally is a tsc problem.
When the compile target is set to ES5, module imports with a default import are transpiled to e.g. modulevar.default(). This breaks in IE9.
While it is a view chars longer the ES5 mode should product modulevar["default"]() instead for IE9 compatibility.

@KnisterPeter KnisterPeter reopened this Aug 5, 2015
@danquirk
Copy link
Member

danquirk commented Aug 5, 2015

I think #2296 covers the general issue here. Note related pull requests #2387 and #2760

@danquirk danquirk closed this as completed Aug 5, 2015
@danquirk danquirk added the Duplicate An existing issue was already created label Aug 5, 2015
@alexkrauss
Copy link

The referenced issues only cover ES3 behaviour. However, IE9 claims ES5 support, but it still does not accept modulevar.default.

Does this mean we must use ES3 to be compatible with IE9? Or could tsc output modulevar["default"] also in ES5 mode?

@KnisterPeter
Copy link
Contributor Author

Currently you have to use ES3 to support IE9.

Alexander Krauss notifications@github.com schrieb am So., 9. Aug. 2015
22:05:

The referenced issues only cover ES3 behaviour. However, IE9 claims ES5
support, but it still does not accept modulevar.default.

Does this mean we must use ES3 to be compatible with IE9? Or could tsc
output modulevar["default"] also in ES5 mode?


Reply to this email directly or view it on GitHub
#4145 (comment)
.

@andrewmurphyio
Copy link

This is seriously affecting my ability to use TS

Can I suggest a switch or tsconfig option to enable this functionality?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 29, 2016

Can I suggest a switch or tsconfig option to enable this functionality?

use --target ES3.

@andrewmurphyio
Copy link

andrewmurphyio commented Apr 29, 2016

@mhegazy no that's not the same. That removes support for property get/set.

I need support for this and get/set.

So either "--target ES3" needs to convert property get/sets into get/set[PropertyName] or the ES5 conversion needs to do export["default"]

@KnisterPeter
Copy link
Contributor Author

The easiest solution for your problem would be to write a babel plugin to do the transforms from es5 to es3 which you need. And then run babel on your sources after typescript did.
But that may not be the best solution.

@andrewmurphyio
Copy link

I'm sure I could

But I still think this should be addressed as an issue with typescript.

I will affect anyone that uses a default export and IE9 and the fix is easy enough - use export['default']

@c9s
Copy link

c9s commented May 26, 2016

Can we add an option this?

something like enableExportDefaultQuote

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

6 participants