Build commands

These commands will allow you generate the code that can be used to run or analyze a Frontity project

Have a look at the environment variables page to check which ones can be used with these commands


Builds the project for production.

npx frontity build [options]

The frontity serve command will use the files generated by this frontity build command.






Builds the project for development. Related environment variable: FRONTITY_BUILD_DEVELOPMENT​

--target <target>

Create bundles with "es5", "module" or "both". Default target is "both". Related environment variable: FRONTITY_BUILD_TARGET​

​--publicPath <path>​

Set the public path for static assets. Default path is "/static/". Related environment variable: FRONTITY_BUILD_PUBLIC_PATH​


Output usage information


  • Builds the project for production using an external domain as the path for static files

npx frontity build --public-path=""

The --development option

This flag correspond to webpack’s mode parameter so it will run webpack in the development mode as described there.

For example, when running react in development mode (when process.env.NODE_ENV is set to development and NOT to production) you get full error messages and warnings from React but at the cost of slower performance.

npx frontity build --development

So, it’s basically the same as just running frontity dev except that it will only build the project once and will not run the development server.

The --public-path option

By default Frontity will look for static assets in the path <YOUR-DOMAIN>/static

With the --public-path option you can change the path from where you are serving the statics assets (i.e. js chunk files, fonts, images, etc.)

The public path is included in the generated files by webpack and cannot be changed after that.

In case some people need to change it (because of constrains in their site architecture) they would need an option to do so just before generating the Frontity bundle with npx frontity build.

This option is also available for dev command


npx frontity build --public-path="/other/folder"