feat: support ts import type modifiers on import names#28
Closed
haoqunjiang wants to merge 2 commits into
Closed
Conversation
This feature is introduced in TypeScript 4.5: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names And recommended in `@vue/tsconfig`: https://github.com/vuejs/tsconfig/blob/26fc528db347dbbbbaa2ea15d3c2d95c197887b7/tsconfig.json#L19-L23 Sucrase does not support it yet: alangpierce/sucrase#668 So I replaced it with `@babel/standalone`. Babel supported the new syntax since v7.16. So I also updated the project dependencies to ensure that `vue/compiler-sfc` can also parse this syntax. The bundle is a lot bigger after this change: ``` dist/vue-repl.js 5040.05 KiB / gzip: 840.42 KiB ``` But it is still much smaller than the size of a full TypeScript compiler or `esbuild-wasm`, which are 9MiB+ in size.
Member
|
Babel is huge and slow... maybe we should consider using esbuild-wasm instead |
Member
Author
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature is introduced in TypeScript 4.5:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names
And recommended in
@vue/tsconfig:https://github.com/vuejs/tsconfig/blob/26fc528db347dbbbbaa2ea15d3c2d95c197887b7/tsconfig.json#L19-L23
Sucrase does not support it yet:
alangpierce/sucrase#668
So I replaced it with
@babel/standalone.Babel supported the new syntax since v7.16.
So I also updated the project dependencies to ensure that
vue/compiler-sfccan also parse this syntax.The bundle is a lot bigger after this change:
Before this PR:
But it is still much smaller than the size of a full TypeScript compiler
or
esbuild-wasm, which are 9MiB+ in size.