@builder.io/monorepo v0.0.1-mono
@builder.io/monorepo
Contains utility function which allows requiring code from modules compiled as mono-repo.
For example @builder.io/qwik is compiled from repos/@builder.io/qwik but we want to require it from @builder.io/qwik.
The utility allows requiring code from @builder.io/qwik and it rewrites node_modules so that even thought @builder.io/qwik source is not in the node_module it can still see other items in the node_module.
Usage
Note: example uses jsx-lite/core as an example of a facade package
- create a
@jsx-lite/corefacade inreposfolder. - create
package.jsonwhich containsindex.jslike so:const monorepoRequire = require('../../monorepo-require'); module.exports = monorepoRequire('jsx-lite/packages/core/src/index.js', module.parent); - Result is that one can import
@jsx/lite-coredirectly from facade, but will receive implementation from mono-repo. - The tricky part is that the implementation of
@jsx/lite-corewill have visibility to the importingnode_modulesmaking it look like as if the code was actualy in thenode_modules
What would happen without this package.
imagine:
- packages
- api
- node_modules
- @jsx-lite/core => ../../jsx-lite/packages/jsx-lite_core.js
- bar_pkg
- jsx-lite
- packages
- jsx-lite_core.jsWithout the @builder.io/monorepo importing @jsx-lite/core would result in import from jsx-lite_core.js. So far so good. However, if the would try to import bar_pkg from jsx-lite_core.js it would fail because jsx-lite_core.js does not have a node_module nearby with bar_pkg. The whole purpos of @builder.io/monorepo is to make it look like the cod of jsx-lite_core.js is actually in packages/api/node_modules.
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago