Node Static
Build Node-based frameworks into static output and serve the exported files.
Detection
Node Static recognizes framework dependencies, static export configuration, and known build commands. It is scored before the Node.js provider when the project has static output.
Supported frameworks
The following defaults come from the detected framework. ANYBUILD_STATIC_DIR or the generated static_dir config can override any of them.
| Framework | Config value | Default static_dir |
|---|---|---|
| Angular | angular | dist |
| Assemble | assemble | dist |
| Astro | astro | dist |
| Brunch | brunch | public |
| Create React App | create-react-app | build |
| Docusaurus | docusaurus | build |
| Docusaurus (legacy) | docusaurus-old | build |
| Eleventy | eleventy | _site |
| Ember | ember | dist |
| Gatsby | gatsby | public |
| Harp | harp | www |
| Hexo | hexo | public |
| Ionic Angular | ionic-angular | www |
| Ionic React | ionic-react | dist |
| Metalsmith | metalsmith | build |
| Next.js static export | next | out |
| Nuxt 2 | nuxt | dist |
| Nuxt 3 | nuxt3 | .output/public |
| Parcel | parcel | dist |
| Polymer | polymer | build/default |
| Preact | preact | build |
| Remix | remix | build/client |
| Remix v1 / remix-ssg | remix-old | build/client |
| Remix v2 with Vite | remix-v2 | build/client |
| Remix v2 classic | remix-v2-classic | public |
| Sanity | sanity | dist |
| Sanity v3 | sanity-v3 | dist |
| Storybook | storybook | storybook-static |
| Stencil | stencil | www |
| Svelte | svelte | build |
| SvelteKit | sveltekit | build |
| TanStack Start | tanstack-start | dist/client |
| UmiJS | umijs | dist |
| Vite | vite | dist |
| VitePress | vitepress | docs/.vitepress/dist |
| Vue CLI | vue | dist |
| VuePress | vuepress | docs/.vuepress/dist |
Build and output
The provider selects the package manager, runs the detected build, generate, export, or docs build script, and copies the framework-specific output directory into the shared static artifact.
Configuration
Node Static inherits the build configuration from the Node.js provider configuration and the output and serving configuration from the Static Files provider configuration. Any configuration field or environment variable documented on those pages can also be set for Node Static.
load("//anybuild/tools:node_static.bzl", "nodestatic_build", "nodestatic_config")load("//anybuild/tools:staticfile.bzl", "staticfile_serve")
config = nodestatic_config( schema = 1, sws_version = "2.38.0", static_dir = "dist", node_package_manager = "npm", node_framework = "vite", node_server = "node", node_build_command = "npm run build", node_version = "24",)
build = nodestatic_build(config)
staticfile_serve(config, build, name = "site")