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
On our codebase (with a simplified config), depcruiser takes 7 seconds to complete. As soon as the "coffeescript" package is installed, it takes 40 seconds instead.
I understand that automatically using the transpiler if it is installed is an intended feature. However, this performance behaviour is surprising and not easy to debug. It took a while for me to pinpoint "coffeescript" as the culprit.
I see a several options to improve this:
Print a warning if the CoffeeScript transpiler is used and there are many .js files
Print a warning if the CoffeeScript transpiler is used and there are no .coffee files
Do not use the CoffeeScript transpiler if there are no .coffee files
Make the CoffeeScript transpiler opt-in in the config
The text was updated successfully, but these errors were encountered:
Hi @neelance (sorry for the slow response - private life takes a bit more time than previously at the moment).
I can think of two things within the program that'd explain slower execution with the mere pressence of the coffeescript compiler:
At start-up time it will try to load the coffeescript compiler. This will make dependency-cruiser's startup time a bit slower (on my local machine it's 10ms). I don't think that's the culprit here.
During module resolution - dependency-cruiser by default configures the resolver to go through the list of extensions it has a compiler for available, until it finds a hit. If there's a few modules that can't be resolved to disk at all, the resolver will run through the entire list - which will be noticeable in its run time, especially so for coffeescript as it supports a whopping 6 extra extensions to try out. From your description this seems what is happening.
depcruise --info will show you the compilers dependency-cruiser found as well as the list of extensions it (as a consequence) supports (and hence scans) by default.
A potential fix/ workaround:
With the enhancedResolveOptions.extensions option you can curb this (safe but potentially slow) default behavior by limiting the extensions it scans. This is also what depcruise --init will attempt when it scaffolds a .dependency-cruiser.js - it scans the contents of your source folder and set up the extensions property to those it found there.
On our codebase (with a simplified config), depcruiser takes 7 seconds to complete. As soon as the "coffeescript" package is installed, it takes 40 seconds instead.
I understand that automatically using the transpiler if it is installed is an intended feature. However, this performance behaviour is surprising and not easy to debug. It took a while for me to pinpoint "coffeescript" as the culprit.
I see a several options to improve this:
.js
files.coffee
files.coffee
filesThe text was updated successfully, but these errors were encountered: