add support for webpack alias #20
Comments
At the moment, only typescript aliases are supported. I think we can add support for webpack, but I'm not sure what to do with babel. Babel configs are highly dynamic. An alternative would be to add support for specifying an mapping in |
I'm a little confused as to why this is directly related to Webpack. Isn't that what we need to do to find all imported files by parsing, It doesn't matter which way we use to set the alias in project. |
Node doesn't support something like import aliases, that's why you declare them in your webpack config. This project does read import aliases from tsconfig, but not from a webpack config. Hence, it doesn't resolve the aliased file paths. It's not related to webpack itself. It's related to you using import aliases. |
This may also fix smeijer#20.
@smeijer thanks for this great project! I wonder if there's some method I'm overlooking to deal with a situation like this: We have a monorepo with a lot of shared code, and then some platform-specific code with package names like Is there any way to accommodate both of these circumstances with the current configuration capabilities? As it is right now, For web we use Webpack The only other option that occurs to me right now would be for us to make multiple Thank you again for this great project! |
With Edit: Unless I'm doing something wrong, I guess we can't specify |
Hi @slapbox , it is possible to specify {
"entry": ["src/main.ts", "src/pages/**/*.{js,ts}"],
} |
Hey @smeijer, thanks for your reply! What I mean is to allow resolutions to be set on a per-entry basis. So in your example, maybe It seems like "entryFiles": [
{
"file": "src/main.ts",
"aliases": {
"our-utils-platform": "our-utils-node
},
"extensions": [ ".js", ".ts", ".tsx" ]
},
{
"file": "src/pages/**/*.{js,ts}",
"aliases": {
"our-utils-platform": "our-utils-web
},
"extensions": [ ".js", ".ts", ".tsx" ]
}, Does that explanation make sense? Thanks again for your hard work and for your reply! |
Cannot detect the imported file if a project not use relative path import.
For example, use
babel-plugin-module-resolver
:or use webpack
resolve. alias
The text was updated successfully, but these errors were encountered: