Resolve deps/configs within task functions, and use nano-spawn to run bins#874
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, some tasks (
esbuildTask,prettierTask,tarTask,tscTask,webpackCliTask) would resolve dependencies and/or configs when the task creation function was called, rather than when the task was run. This means there's the perf hit for resolving each of those deps/files on every config load, even if the task isn't used, which adds up in large repos.This PR updates the tasks above to do all their resolution within the task function itself (the other tasks already did this).
Related changes:
tsc,prettier, etc), make the binary resolution more resilient across package versions by looking atpackage.jsonbininstead of hardcoding. Also run the binaries withnano-spawnfor better built-in error handling and other features.nodeExecTask, run tasks withnano-spawninstead ofcross-spawn. Behavior is similar, but it changes thespawnOptionstype slightly, and theenvoption is always merged with the currentprocess.env.Introducing
nano-spawn(which is ESM) requires running Jest tests viacross-env NODE_OPTIONS='--experimental-vm-modules' jest ...to make the async imports work.Fixes #814