CLI

The marko-run CLI develops, builds, and previews Marko Run applications. It is installed with @marko/run and run with npm exec marko-run or from package.json scripts.

The CLI has three commands: dev, build, and preview. All commands accept these options:

OptionDescription
-c, --configPath to a Vite config file (by default, looks for a vite.config file with a .js, .cjs, .mjs, .ts, or .mts extension)
-e, --envPath to a dotenv file

dev

Starts a development server in watch mode. This is the default command, so both of the following are equivalent:

npm exec marko-run
npm exec marko-run dev
OptionDescription
-p, --portPort to listen on (defaults: server.port then preview.port in the Vite config, the PORT env variable, or 3000)

build

Creates a production build.

npm exec marko-run build
OptionDescription
-o, --outputDirectory to write built files (default: build.outDir in the Vite config)

preview

Creates a production build and starts a production-like server.

npm exec marko-run preview
OptionDescription
-o, --outputDirectory to serve files from, and write built files to (default: build.outDir in the Vite config)
-p, --portPort the server should listen on (defaults: preview.port then server.port in the Vite config, the PORT env variable, or 3000)
-f, --fileOutput file to start

Next Steps


Contributors

Helpful? You can thank these awesome people! You can also edit this doc if you see any issues or want to improve it.