nx/packages/next/docs/library-examples.md

675 B

Examples

{% tabs %} {% tab label="Create a new lib" %}

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 for more details. {% /callout %}

nx g lib my-lib --directory=libs/shared/my-lib

{% /tab %} {% /tabs %}