-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
paths remapping is not done for type declarations #125
Comments
Looks like this should work without Somewhat related #112 |
No, without rollup-plugin-alias I get the same result; all mapped paths in the declaration files are not de-mapped (if that is the right word). That's why I tried that plugin in the first place. I will study the issue you linked, thanks. |
paths
remapping is not done for type declarations
paths
remapping is not done for type declarations
Looks like this is a typescript problem, paths feature is not quite complete(?), see microsoft/TypeScript#16088 and microsoft/TypeScript#27218. Try removing |
Ah I see. Boy, I'm having a hard time liking TypeScript to be honest. Always something... Anyway, I tried your suggestion, leaving out semantic error TS2307 Cannot find module '@src/...'. error. So obviously the TypeScript compiler doesn't like it when you attempt to use custom formatted paths without explicitly telling it so. That makes sense actually. I think I will leave the whole path mapping for now and just go back to using relative paths. Kind of regret having to do this, but it is not worth all the trouble I am running into here. |
I have the same problem. My package with issue. How to make path in Without
|
I could do the paths remapping with @iliyaZelenko thanks for the hint! |
Another way is try to configure rollup-plugin-typescript2 with typescript: ttypescript and tsconfig.json > compilerOptions > |
// tsconfig.build.json
// ...
"moduleResolution": "node",
"plugins": [
{
"transform": "@zerollup/ts-transform-paths",
"exclude": ["*"]
}
]
// ... // rollup.config.js
/* eslint-disable import/no-default-export */
import cleaner from 'rollup-plugin-cleaner'
import typescript from 'rollup-plugin-typescript2'
import ttypescript from 'ttypescript'
export default {
input: `./src/index.ts`,
output: [
{ file: 'lib/index.js' },
],
plugins: [
cleaner({
targets: ['./lib'],
}),
typescript({
tsconfig: 'tsconfig.build.json',
typescript: ttypescript
}),
],
} |
Going to mark this as duplicate of #201. |
Is it possible to use this plugin together with rollup-plugin-alias to replace mapped paths with their "true" paths and if not, would you have a recommendation for a plugin which could do that? I found this. But unfortunately it doesn't resolve my problem or answers my question.
What I am trying to do; I am trying to replace the mapped paths / path aliases (i.e.
@src
) with the correct path in the transpiled type files. I've tried with the setup below and everything compiles fine. However, my type declaration files that contain a reference to a mapped path are not replaced. So to give an example, I have aCallable.d.ts
file after transpilation that looks likeinstead of
My tsconfig.json, rollup.config.js files and src folder are located at the same (top) level.
Versions
rollup.config.js
tsconfig.json
The text was updated successfully, but these errors were encountered: