Farm CLI
The Farm CLI allows you to start, build, preview, and watch your application.
To get a list of cli available to Farm, run the following command inside your command
Terminal
npx farm -h
The output look like this:
Terminal
farm/0.5.11
Usage:
$ farm [root]
Commands:
[root] Compile the project in dev mode and serve it with farm dev server
build compile the project in production mode
watch watch file change
preview compile the project in watch mode
clean [path] Clean up the cache built incrementally
plugin [command] Commands for manage plugins
For more info, run any command with the `--help` flag:
$ farm --help
$ farm build --help
$ farm watch --help
$ farm preview --help
$ farm clean --help
$ farm plugin --help
Options:
-l, --lazy lazyCompilation
--host <host> specify host
--port <port> specify port
--open open browser on server start
--hmr enable hot module replacement
--cors enable cors
--strictPort specified port is already in use, exit with error
-c, --config <file> use specified config file
-m, --mode <mode> set env mode
--base <path> public base path
--clearScreen allow/disable clear screen when logging
-h, --help Display this message
-v, --version Display version number
Startâ
farm start
The command is used to start the development server and compile the code in the development environment
Terminal
Usage:
$ farm [root]
Options:
-l, --lazy lazyCompilation
--host <host> specify host
--port <port> specify port
--open open browser on server start
--hmr enable hot module replacement
--cors enable cors
--strictPort specified port is already in use, exit with error
-c, --config <file> use specified config file
-m, --mode <mode> set env mode
--base <path> public base path
--clearScreen allow/disable clear screen when logging
Buildâ
farm build
The command builds the products that can be used in the production environment in the default dist
directory.
Terminal
Usage:
$ farm build
Options:
-o, --outDir <dir> output directory
-i, --input <file> input file path
-w, --watch watch file change
--targetEnv <target> transpile targetEnv node, browser
--format <format> transpile format esm, commonjs
--sourcemap output source maps for build
--treeShaking Eliminate useless code without side effects
--minify code compression at build time
-c, --config <file> use specified config file
-m, --mode <mode> set env mode
--base <path> public base path
--clearScreen allow/disable clear screen when logging
-h, --help Display this message