nx/packages/next/docs/library-examples.md
2023-10-23 11:55:34 -04:00

25 lines
668 B
Markdown

## Examples
{% tabs %}
{% tab label="Create a new lib" %}
```shell
nx g lib my-lib
```
{% /tab %}
{% tab label="Create a new lib under a directory" %}
The following will create a library at `libs/shared/my-lib`.
{% callout type="note" title="Directory Flag Behavior Changes" %}
The command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=shared`. See the [workspace layout documentation](/deprecated/workspace-layout) for more details.
{% /callout %}
```shell
nx g lib my-lib --directory=libs/shared/my-lib
```
{% /tab %}
{% /tabs %}