rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.61k stars 574 forks source link

@rollup/plugin-typescript / `{type X}` imports are not elided correctly #1588

Open arklanq opened 1 year ago

arklanq commented 1 year ago

Please read README.md first.

Expected Behavior

Import such as import {type X} from 'y':

// Source code
import {type App} from './App.js';

... should be elided and dropped entirely.

Actual Behavior

... but instead, the import is preserved:

// Output code
import './App.js';

Another example

On the other hand, import type {X} from 'y' works perfectly fine

// Source code
import type {App} from './App.js';
// Output
// No import is generated for the above source code

Additional Information

Related

gwicksted commented 4 months ago

This works with the latest version of rollup as long as: