You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've configured my tsconfig.json with a baseUrl set to ./app/javascript. So I write import { foo } from 'utility' and it imports from ./app/javascript/utility. Dependency Cruiser, however, sees utility as a top-level import and shows me a graph like this:
It would be really great to see Dependency Cruiser follow Babel/TS/Webpack/whatever's config for base paths and show imports like utility coming from the right place. Here's a non-exhaustive list of details that would need to be addressed:
The import logic is intelligent enough to distinguish between utility, which is in ./app/javascript/utility, and react, which is in ./node_modules/react.
tsconfig.json supports baseUrl as well as specific path aliases using paths (e.g., @utility --> ./app/javascript/utility).
There are all kinds of plugins for Babel/TS/Webpack/whatever that allow for "syncing" path settings from one tool to the other (here's a popular example)
Perhaps the easiest way to handle the myriad cases is to simply create baseUrl, paths and externals settings in the plugin's config and allow users to manually specify the base path, aliases and any external module declarations.
One last consideration: if you let users declare the base path, they will probably need to give an absolute path since VS Code could be launched from whatever pwd. Not sure whether there's a way around that.
The text was updated successfully, but these errors were encountered:
ersinakinci
changed the title
Respect Babel/TS/Webpack/whatever base paths
Respect Babel/TS/Webpack/whatever base paths, aliases and externals
Sep 8, 2020
I've configured my
tsconfig.json
with abaseUrl
set to./app/javascript
. So I writeimport { foo } from 'utility'
and it imports from./app/javascript/utility
. Dependency Cruiser, however, seesutility
as a top-level import and shows me a graph like this:It would be really great to see Dependency Cruiser follow Babel/TS/Webpack/whatever's config for base paths and show imports like
utility
coming from the right place. Here's a non-exhaustive list of details that would need to be addressed:utility
, which is in./app/javascript/utility
, andreact
, which is in./node_modules/react
.tsconfig.json
supportsbaseUrl
as well as specific path aliases usingpaths
(e.g.,@utility
-->./app/javascript/utility
).jsconfig.json
has options similar totsconfig.json
but for VS Code (doesn't depend on TS).module-resolver
plugin hasroot
andalias
config options.resolve
options.Perhaps the easiest way to handle the myriad cases is to simply create
baseUrl
,paths
andexternals
settings in the plugin's config and allow users to manually specify the base path, aliases and any external module declarations.One last consideration: if you let users declare the base path, they will probably need to give an absolute path since VS Code could be launched from whatever pwd. Not sure whether there's a way around that.
The text was updated successfully, but these errors were encountered: