Skip to main content
Version: 1.0.0

Quick Start

note

Farm needs Node 16.18.0 and above.

Online experience​

Edit Farm

Create a Farm Project​

npm
yarn
pnpm
bun
npm create farm@latest
Then follow the prompts!

You can also directly specify the project name and the template you want to use via additional command line options:

npm
yarn
pnpm
bun
npm create farm farm-app --template react

2. Start the Project​

Choose the package manager you like, install dependencies, then start the project. Then, start the project:

npm
yarn
pnpm
bun
cd farm-app && npm install && npm start

The project will start at http://localhost:9000 by default.

3. Configuring the Project​

The project is configured by farm.config.ts/js/mjs file in the root directory of the project.

farm.config.ts
import { defineConfig } from "@farmfe/core";

export default defineConfig({
// Options related to the compilation
compilation: {
input: {
// can be a relative path or an absolute path
index: "./index.html",
},
output: {
path: "./build",
publicPath: "/",
},
// ...
},
// Options related to the dev server
server: {
port: 9000,
// ...
},
// Additional plugins
plugins: [],
});
note

See Configuring Farm for details.

4. Building the project​

Build the Farm project as production-ready static files:

npm
yarn
pnpm
bun
npm run build

The built product is downgraded to ES2017 by default, and the product will be compressed and Tree Shake. If you want to preview the build product locally, you can execute npm run preview or npx farm preview.

note

See Build For Production for details.

Next Steps​


Extremely Fast Web Build Tool Written in Rust

Copyright Š 2024 Farm Community. Built with Docusaurus.