xplat
xplat copied to clipboard
Publishable Feature/Library
In Nx there is option to generate Library as npm package including schemantics for build,link,test
nx g library mypackagelibrary --publishable
After installing xplat the option is not possible to use anymore with getting error: Could not match option 'publishable' to the @nstudio/xplat:library schema.
Is there any way how to make it work again (for Library/Feature).
Many thanks!
@pavelekNET this is likely due to your default schematic setting. xplat sets @nstudio/xplat as defaultCollection inside the cli section of workspace.json. You can set this to any schematics you have installed in your workspace; whichever you invoke/use the most.
Try this:
nx g @nrwl/angular:library mypackagelibrary --publishable --dry-run
Assuming you may be wanting to generate an angular based libary.
If not you can prefix the library generator command with any of @nrwl's packages that support library.
I'd also recommend installing Angular Console plugin if you use VS Code - really helps navigating and working with all sorts of schematics in your workspace.
@mbaljeetsingh this command works great, command nx build mypackagelibrary builds the package. But there is a problem when I reference some module that is included in "paths" of tsconfig.json.
For example if exists in root tsconfig.json:
"paths": { "@myworkspace/*": ["libs/features/*"], "@myworkspace/shared": ["libs/shared/index.ts"] }
i get many errors with:
..... is not under 'rootDir' 'mypackagelibrary\src'. 'rootDir' is expected to contain all source files.
ok i find out that this is problem of NX architecture with publishable libraries and will be reworked in 8.12 version --> https://github.com/nrwl/nx/issues/602