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

feat: support typestripping extension #435

Merged
merged 18 commits into from
Jan 20, 2025
Merged

feat: support typestripping extension #435

merged 18 commits into from
Jan 20, 2025

Conversation

guybedford
Copy link
Owner

@guybedford guybedford commented Sep 29, 2024

This brings back the old SystemJS workflow of supporting TypeScript in-browser, making for a nice es-module-shims modern JS dev experience.

This implements a new es-module-shims-typescript.js extension that is loaded dynamically when TypeScript syntax is imported that inlines the Amaro project to support the same type stripping from Node.js.

With this change, files served with a TypeScript MIME type or without a valid module MIME type but with a .ts or .tsm extension automatically get type stripping applied. Because TS files break browsers it automatically engages polyfill mode but also works in shim mode too.

It ends up being around a 2MB loader file, and we can probably get this down with future optimizations.

@guybedford guybedford changed the title feat: support typestripping dev build feat: support typestripping extension Jan 20, 2025
@guybedford guybedford merged commit 2c2bc14 into main Jan 20, 2025
10 checks passed
@guybedford guybedford deleted the typestripping branch January 20, 2025 05:55
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 this pull request may close these issues.

1 participant