-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nuxt): nodes for build, serve targets
- Loading branch information
Showing
17 changed files
with
628 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: Overview of the @nx/nuxt/plugin | ||
description: The @nx/nuxt/plugin adds Nuxt targets/projects to the Nx project graph. This allows you to run Nuxt for projects that have a nuxt.config.ts file without creating a project.json file. | ||
--- | ||
|
||
{% callout type="note" title="Still in beta" %} | ||
This feature is still in beta. To use it you must have the `NX_PCV3` environment variable set to `"true"`. | ||
{% /callout %} | ||
|
||
## What is the @nx/nuxt/plugin? | ||
|
||
The `@nx/nuxt/plugin` adds Nuxt targets/projects to the Nx project graph. This allows you to run Nuxt for projects that have a `nuxt.config.ts` file without creating a `project.json` file. | ||
|
||
This is an effort to reduce duplicate code and configurations for your projects that use Nuxt. | ||
|
||
## How it works | ||
|
||
The `@nx/nuxt:init` generator which is called through the `@nx/nuxt:application` generator the following entry is added in the `plugins` array of your `nx.json`: | ||
|
||
```json | ||
... | ||
plugins: [ | ||
{ | ||
"plugin": "@nx/nuxt/plugin", | ||
"options": { | ||
"buildTargetName": "build", | ||
"serveTargetName": "serve", | ||
}, | ||
}, | ||
... | ||
] | ||
``` | ||
|
||
This will create targets for `build` and `serve` in your project graph, so that you can run `nx build my-app`, `nx serve my-app` etc, without manually defining these targets in each of your projects' `project.json` files. This will work for every single project in your workspace that has a `nuxt.config.ts|js` file. | ||
|
||
## How to configure | ||
|
||
The plugin generates these targets with bare minimum (no extra) options configuration. Any options you need for your Nuxt app, you can add in your project's `nuxt.config.ts`. | ||
|
||
If you want to add some universal options for all your `build` targets, for example, you can still do so in the [`targetDefaults`](/recipes/running-tasks/reduce-repetitive-configuration#reduce-configuration-with-targetdefaults). | ||
|
||
You can edit the name of your targets if you want to use a different name. For example, you can have this configuration: | ||
|
||
```json | ||
... | ||
plugins: [ | ||
{ | ||
"plugin": "@nx/nuxt/plugin", | ||
"options": { | ||
"buildTargetName": "build-core", | ||
"serveTargetName": "serve", | ||
}, | ||
}, | ||
... | ||
] | ||
``` | ||
|
||
and this will create `build-core` and `serve` targets in your project graph. You can then call `nx build-core my-app` for all your projects that have a `nuxt.config.ts|js` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { createNodes, NuxtPluginOptions } from './src/plugins/plugin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.