-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support/ignore export as namespace
TypeScript syntax
#2070
Comments
It is weird. |
I thought so too, but this comment from the changelog seems to suggest the opposite. |
You aren't supposed to feed esbuild |
Thanks for the help @magic-akari and @evanw! I've spent some more time looking into this issue and realized that it was partly caused by the following setting in my project's
I initially set this up to work around an issue with TypeScript's experimental Maybe the real fix here isn't to add support for I've created a little reproduction repo (with regular TypeScript module resolution because that doesn't seem to be part of the issue) here which has two scripts ( |
agree with you. |
Recently I've come across multiple packages which use the (admittedly poorly documented)
export as namespace
syntax in their declaration files to declare that they provide both CommonJS exports and a global namespace object. Searching DefinitelyTyped alone brings up 706 occurrences of this pattern.When bundling a script importing one of these packages ESBuild reports the following error:
It seems like ESBuild simply doesn't know the
export as namespace
syntax yet, so theas
keyword is flagged as unexpected in that context.Proposal
Since (as far as I know) ESBuild only supports actual module formats (and not global namespace objects), I think it would be a good enough solution to just completely ignore that line. Modules containing it would then be treated solely according to their remaining export declarations.
The text was updated successfully, but these errors were encountered: