[typescript] Plugin does not convert native nodejs imports in d.ts files
- Rollup Plugin Name:
@rollup/plugin-typescript - Rollup Plugin Version: 11.1.4
- Rollup Version: 3.29.3
- Operating System (or Browser): Windows 11
- Node Version: v18.18.0
- Link to reproduction: https://stackblitz.com/edit/rollup-repro-zaitva?file=dist%2Fmain.d.ts
Expected Behavior
Correct paths in .d.ts files (like in .js files)
Actual Behavior
The files contain the imports as they appear in the source files
Additional Information
package.json:
{
...
"imports": {
"#src*": {
"default": [
"./src/*",
"./src/*.ts",
"./src/*.tsx",
"./src/*/index.ts",
"./src/*/index.tsx"
]
}
},
...
}
src/main.ts:
import { testValue } from '#src/test';
export { testValue };
dist/main.js
export { testValue } from './test.js';
dist/main.d.ts
import { testValue } from '#src/test';
export { testValue };
//# sourceMappingURL=main.d.ts.map
I have the same problem. do you have any ideas at present? cc @shellscape
@PBK-B Unfortunately, I still had to move the import declaration to paths in tsconfig, and use a rollup plugin based on tsc-alias.
@PBK-B Unfortunately, I still had to move the import declaration to paths in tsconfig, and use a rollup plugin based on tsc-alias.
@e965 Thank you. I also adopted the same solution yesterday and used tsc-alias to deal with it. If I have time, I can look at the code and maybe analyze the reason.