Skip to content

Help

Nx does not list an Astro project, or it has no targets.

  1. Check that nx.json lists @geekvetica/nx-astro in plugins. If not, run nx g @geekvetica/nx-astro:init.
  2. Check that the directory has an astro.config.mjs, .js or .ts.
  3. Run nx reset, then nx show projects.

The paths in an app’s tsconfig.json replace those of the workspace. Aliases of libraries that are newer than the app have to be added by hand.

check reports error 6307 for a shared component

Section titled “check reports error 6307 for a shared component”

The workspace config sets composite. Add the library to include of the app’s tsconfig.json, as shown in Share code between apps.

A module such as astro:content has no types

Section titled “A module such as astro:content has no types”

Generate them:

Terminal window
nx run my-app:sync

If the target reports a cache hit, remove "cache": true from it in project.json.

The first build changes package.json of the app, so the second one runs as well. Commit that change.

The build comes from the cache, but the output is missing

Section titled “The build comes from the cache, but the output is missing”

The site is built outside the cached output path, so Nx has nothing to restore. Point outDir there.

test fails because there are no test files

Section titled “test fails because there are no test files”

With vitest in the root package.json, every Astro project gets a test target. Let projects without tests pass:

nx.json
{
"targetDefaults": {
"@geekvetica/nx-astro:test": {
"options": { "additionalArgs": ["--passWithNoTests"] }
}
}
}

The root tsconfig.json references a directory without a tsconfig.json. Create the file in that project, or remove the reference.

pnpm wants to know which packages may run install scripts. Choose them with pnpm approve-builds and run the command again.

Can I use React, Vue or another framework?

Section titled “Can I use React, Vue or another framework?”

Yes. Install the Astro integration in the workspace root and add it to the Astro config of the app. The build copies @astrojs/* versions to the app.

Yes, see Server rendering with Node. Adapters belong in the Astro config.

build, check and test. CI and caching lists their inputs.

No. An Astro config is enough for the inferred targets.

Report a bug or ask for a feature in the issues on GitHub. Include the versions of the plugin, Nx and Astro, and the output of the command with --verbose.

nx-astro is developed and maintained by Geekvetica.

nx-astro 3.2.0 · MIT Developed by