Closed huozhi closed 1 year ago
Thanks for the report, I will look into this!
@huozhi
I've found the cause of the issue. But as it stands, it seems unfixable:
src/index.ts
, SWC doesn't know the existence of src/types.ts
.IConfig
in import { IConfig } from './types'
is a type or a value.You can workaround the issue by explicitly declaring IConfig
as a type-only import:
import type { IConfig } from './types';
// or
import { type IConfig } from './types';
This can be enforced / auto-fixed through the use of the @typescript-eslint/eslint-plugin
with the @typescript-eslint/consistent-type-imports
rule:
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }]
Expect behavior
I can export ts type in ts entry file, and in output it could be erased in js asset. And rollup won't complain about resolving
Observed behavior
Reproduction
https://github.com/beeebox/swc3-export-type-repro