Open khell opened 7 years ago
This also breaks with a Lerna monorepo when using --hoist
.
Unfortunately, some tooling does not follow the module resolution spec closely, and instead assumes or requires that dependencies are present specificially in the local node_modules directory. To work around this, it is possible to symlink packages from their hoisted top-level location, to individial package node_modules directory. Lerna does not yet do this automatically, and it is recommended instead to work with tool maintainers to migrate to more compatible patterns.
My workaround is to just make a symlink (or copy) babel-core
into the package's node_modules
.
If
useBabel: true
property is set under a Yarn Workspaces monorepo, and ifbabel-core
has successfully been hoisted to the rootnode_modules
directory, thenat-loader
fails and prints the error messageBABEL_ERROR
, because it can no longer find Babel at the absolute path specified byat-loader
.This can easily be resolved by also passing
babelCore: 'babel-core'
, which then falls back onto Node's module resolution.What is the reasoning behind not using Node's module resolution by default?