Closed stavalfi closed 5 years ago
not working example:
index.js: require('file1')
file1.ts: export default {x:1}
when parsing index.js with this plugin : require("file1")
working example
file1.js: export default {x:1}
when parsing index.js with this plugin : require("./file1")
{ "plugins": [ [ "module-resolver", { "root": ["./src"] } ] ] }
what is the problem with typescript files?
ok, I found the problem:
https://github.com/tleunen/babel-plugin-module-resolver/blob/c73bd9d823d2a5c9a0bd0273c56364cf68bdb17e/src/normalizeOptions.js#L13
Why not adding ts,tsx,d.ts files also?
The initial idea was that typescript is not javascript. So you would have to set your own extensions in the plugin options.
https://github.com/tleunen/babel-plugin-module-resolver/blob/master/DOCS.md#extensions
Thanks!!!!!!!
not working example:
index.js: require('file1')
file1.ts: export default {x:1}
when parsing index.js with this plugin : require("file1")
working example
index.js: require('file1')
file1.js: export default {x:1}
when parsing index.js with this plugin : require("./file1")
what is the problem with typescript files?