Closed Singloo closed 1 year ago
Are you not in control of vite-tsconfig-paths
options in your NX project?
You could try setting the projects
option if you are.
Same issue.
projects
option doesn't help.
I haven't browsed the code in this pkg, but if the comment left in code is how it works, then the extends
is buggy:
The
extends
property is supported.
Please include debug logs and a reproduction in your bug report.
DEBUG=vite-tsconfig-paths vite
Thank you for the reply. I think the use of a plugin could be completely replaced w/ a function below, it works for my needs:
export const getResolveConfig = (tsconfig: TsConfigJson) => {
const resolveConfig = {
alias: []
}
const paths = tsconfig.compilerOptions?.paths;
if (!paths) return resolveConfig;
const tsconfigAliasPaths = Object.keys(paths).map((key): Alias => {
const value = paths[key][0];
return {
find: key.replace('/*', ''),
replacement: resolve(value.replace('/*', '')),
};
});
resolveConfig.alias = [...resolveConfig.alias, ...tsconfigAliasPaths];
return resolveConfig;
};
There was a similar comment from @matthew-dean in #116. My response can be seen here: https://github.com/aleclarson/vite-tsconfig-paths/issues/116#issuecomment-1571068640
If you could repost your function in that thread, it wouldn't be off-topic. 👍
Are you not in control of
vite-tsconfig-paths
options in your NX project?You could try setting the
projects
option if you are.
Thanks for your reply. projects
is not working for my case. Resolved by overwriting vite config alias
I'm using it in an nx mono repo containing many tsconfig files. When running storybook, I saw
vite-tsconfig-paths
scanned all config files but used the wrong one, which excluded*.stories.tsx
files.Is there a way to specify which tsconfig file to use?