Open wintercounter opened 5 years ago
Hey there !
Just to get a bit more context:
module-alias
, which is about modules, not naked files.require.resolve('@/aliasedpath/moduleDirWithIndexTsFile')
, it won't get resolved. I could use https://nodejs.org/api/modules.html#modules_require_extensions but it's deprecated so I thought it would be nice to have such support here instead so I can make sure it won't conflict with any other lib touching the module system.require.resolve('alias/file.js')
resolves correctly, path.resolve('alias/file.js')
is not. For resolving modules it's fine to use require.resolve
but for anything else (eg. directories) I should use path.resolve
. It would be also a solution for me if a function would be exported by the package to resolve paths, eg: import { resolvePath }
from 'module-alias'module-alias works with compiled JS folder rather than TS sources, so it could resolve only .js
from dist
(or whatever is destination) folder. If you really need to resolve the .ts
source path, you should create a separate alias that would point to src
folder rather than dist
. So even after it's compiled to JS it would still resolve you .ts
file
I'm using TS in runtime with babel-register so I don't have dist folder, only src.
These are actually 2 separate features.