This plugin for Nx helps injecting local dependencies into a package.
Using npm:
npm install @arthurgubaidullin/nx-embed-dependencies --save-dev
Add a target to project.json
to the library you want to build with dependencies.
{
// ...
"targets": {
// ...
"embed-dependencies": {
"executor": "@arthurgubaidullin/nx-embed-dependencies:run",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/lib-with-dependencies"
}
}
}
// ...
}
Also update your nx.json
.
{
// ...
"targetDefaults": {
// ...
"embed-dependencies": {
"dependsOn": ["build"]
// ...
}
}
}
If you are using grouped libraries, then their names must be valid.
Correct
@workspace/commom-my-lib
Incorrect
@workspace/commom/my-lib
When creating a project in folder, use the --importPath
option.
MIT.