madge
madge copied to clipboard
Mixing javascript and typescript imports doesn't work with compilerOptions.paths
Hello! This is a continuation of https://github.com/pahen/madge/issues/207. This is more of an FYI for madge users, as the fix should happen in filing-cabinet.
This problem occurs with a tsconfig.json that looks like this:
// ./tsconfig.json
{
"compilerOptions": {
"module": "CommonJS", // important to set, madge defaults to AMD.
"allowJs": true,
"paths": { "@/*": ["src/at/*"] },
}
}
and a project layout that looks like this:
// ./src/at/b/index.ts or ./src/at/b.ts
export const foo = 'bar';
// ./src/a.js
import { foo } from '@/b';
console.log(foo);
And to reproduce:
$ madge --ts-config tsconfig.json --warning src/a.js
Processed 1 file (420ms) (1 warning)
a.js
✖ Skipped 1 file
@/b
See https://github.com/dependents/node-filing-cabinet/pull/103
@igrayson were you able to come up with a solution for this?