wwwwwwwwwwwwwwwwwww
One Logo Pool Ball

one build

Building your app for production happens through one build.

It takes the first argument as the platform, which defaults to web.

npx one build [web | ios | android]

To build for iOS for example, you would run:

npx one build ios

Building for web

When building One for web, the output will be a mostly static directory of HTML, CSS, and JavaScript. Internally, One runs a few different Vite production builds to output client, server, and API folders. This output is always in the dist directory.

Ensure your .env file has a ONE_SERVER_URL set to your production URL, like:

Terminal

ONE_SERVER_URL=https://onestack.dev

We provide a production server based on Hono with one serve that handles loaders, SSR, and API routes for you. You can choose a deploy target for that server. This can be chosen via your Vite configuration:

vite.config.ts

import { one } from 'one/vite'
export default {
plugins: [
one({
web: {
deploy: 'vercel' // defaults to 'node'
}
})
]
}

For detailed deployment instructions, see the Deployment Guide.

If you are only using SPA and SSG routes and aren’t using loaders, you can statically serve the results of dist/client using any server you’d like.

Parallel builds with worker threads

By default, One uses worker threads to build static pages in parallel across multiple CPU cores. This can significantly speed up builds for sites with many pages.

You can disable this via config if needed:

vite.config.ts

import { one } from 'one/vite'
export default {
plugins: [
one({
build: {
workers: false
}
})
]
}

Or via environment variable:

Terminal

ONE_BUILD_WORKERS=0 npx one build

Building for native

We don’t have an end-to-end build command yet, but One is designed to be easy to integrate into existing Expo or React Native build processes.

If you’re familiar with EAS, see how to Build and Deliver Native Apps with EAS.

Or check out the iOS Native Guide for instructions on building your iOS app with Xcode.

Edit this page on GitHub.