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

Migrate to SystemJS module format from AMD for bundles #3559

Closed
kitsonk opened this issue Dec 30, 2019 · 0 comments · Fixed by #3965
Closed

Migrate to SystemJS module format from AMD for bundles #3559

kitsonk opened this issue Dec 30, 2019 · 0 comments · Fixed by #3965

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Dec 30, 2019

As pointed out in #2475 comment supporting top level await in bundles is going to be problematic.

In AMD, the define factory function needs to return immediately according to the standard. There are specific issues in the specification relating to attempting to provide an asynchronous define function, and there has been strong feedback to not allow this. While we could of course implement a loader that supported an asynchronous return from the define factory, it would require us to convince the TypeScript team to emit AMD modules that were not compliant to the spec, which they would rightfully push back on.

So the only other "quick" solution is to migrate to SystemJS format for bundles, as the module definition supports asynchronous returns.

Other non-quick solutions is to implement some sort specialised bundle format, which is complicated and may cause more challenges as we hit edge cases in the way exports are handled, and modules formed. I still think it would be a lot better to rely upon something that is done by TypeScript and we handle.

kitsonk added a commit to kitsonk/deno that referenced this issue Feb 11, 2020
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being rexported.

Fixes denoland#2553
Fixes denoland#3559
Fixes denoland#3751
Fixes denoland#3825
Refs denoland#3301
kitsonk added a commit to kitsonk/deno that referenced this issue Feb 11, 2020
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being rexported.

Fixes denoland#2553
Fixes denoland#3559
Fixes denoland#3751
Fixes denoland#3825
Refs denoland#3301
@ry ry closed this as completed in #3965 Feb 12, 2020
ry pushed a commit that referenced this issue Feb 12, 2020
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being re-exported.

Fixes #2553
Fixes #3559
Fixes #3751
Fixes #3825
Refs #3301
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.

1 participant