Build
Options controlling how the publisher runs and reads from your project’s built files.
build.scripts
- Type:
{preview: string;production: string;}
- Default:
{preview: 'build:preview',production: 'build',}
The keys of npm scripts used to build preview and production versions of your project.
import { defineConfig } from '@reuters-graphics/graphics-kit-publisher';
export default defineConfig({ build: { scripts: { preview: 'build:preview', production: 'build', }, },});… which might correspond to npm scripts like:
{ "scripts": { "build:preview": "PREVIEW=true vite build", "build": "vite build" }}build.outDir
- Type:
string;
- Default:
'dist/';
The directory your build system is configured to build your app to.
build.assetsDir
- Type:
string;
- Default:
'cdn';
The directory inside outDir that your build system writes the app’s assets to.
Every archive gets its own copy of this directory so it can serve itself, which is what lets you upload one archive without touching the others.
You only need to set this if your project has renamed that directory. In the graphics kit it’s cdn, set in svelte.config.js — as adapter-static’s assets option and in the path passed to getBasePath:
kit: { paths: { assets: getBasePath(mode, 'cdn', { trailingSlash: false, rootRelative: false }), }, adapter: adapter({ pages: 'dist', assets: 'dist/cdn' }),}If those disagree with this setting, uploading fails rather than shipping an archive that’s missing its own assets — the publisher checks that each archive contains every file its pages reference.