-
Notifications
You must be signed in to change notification settings - Fork 109
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
esModuleInterop is not supported #1112
Comments
Tsickle is now only a library, no binary: |
Thanks @evmar. I tried with tsickle 0.37.1 (using demo.js) and Typescript 3.6.4, and I still reproduce the error. |
@rubenlg I think what Evan is saying is that |
I left this one open because I think the bug is right, we just don't support esModuleInterop. One fix might be for us to check for flags like these and error on start. |
Somehow my comment disappeared from the thread. I tried tscc and got the same error. Note that esModuleInterop is now one of the default flags when you use |
Internal issue created: b/144351394. |
I would prefer to support However, it makes difference to tscc in that it allows writing namespace import statements for external modules in a default export statement, which I think is a good thing. Therefore, I hope tsickle does not error out on
|
@theseanl When you say that it only afffects behavior for importing non-ts modules, what do you mean exactly? In the example I provided above, both If we were to drop the Rewriting the |
I meant that when it is transpiled using I meant by "stripping out |
Thanks for clarifying! Makes sense now. |
Any update on this issue? I'm sure tons of people out there would love to use tsickle with their TypeScript projects, but not supporting "esModuleInterop" seems to be a show-stopper. In my particular case, my project has ES6-style import statements on JSON files, so it requires "esModuleInterop" to be set to true or it won't even compile. As far as I know, this kind of this is the recommended solution / best practice for TypeScript, e.g. the highest upvoted answer here: https://stackoverflow.com/a/50830840 |
If you import JSON files, it won't compile under JSCompiler anyway, so I think this bug in particular isn't blocking you. |
When I run tsickle with
esModuleInterop
, tsickle produces the wrong javascript, with a regularrequire
instead ofgoog.require
.Repro steps:
npm install typescript@~3.5.3 [email protected]
I wish I could use tsickle 0.37.1, but unfortunally the npm package doesn't have a binary (or a main.js file).
tsconfig.json:
a.ts:
b.ts:
Generated a.js:
If I don't use
import * as ...
then the emitted JS is correct.esModuleInterop
is now one of the default flags generated when runningtsc --init
.The text was updated successfully, but these errors were encountered: