Open arklanq opened 1 year ago
This works with the latest version of rollup as long as:
you have included the .ts
file (containing the import type
statement) for compilation in your tsconfig.json
that the @rollup/plugin-typescript
plugin uses.
you are either:
a. using the main tsconfig.json
file; or,
b. not using --configPlugin typescript
which causes your main tsconfig.json
file to be used instead of the one pointed to in your rollup.config.ts
file. In other words, use rollup.config.js
Expected Behavior
Import such as
import {type X} from 'y'
:... should be elided and dropped entirely.
Actual Behavior
... but instead, the import is preserved:
Another example
On the other hand,
import type {X} from 'y'
works perfectly fineAdditional Information
verbatimModuleSyntax
option intsconfig.json
, but after a quick analysis, I have found out there is no difference if this option is on or off.tsc
also generates code incorrectly. It properly elides imports but does not drop them entirely as it should. See repro for more details, I have covered this topic there also. I have not found any open issue about this in the typescript repo.Related