Skip to main content
Version: 0.15

Quick Start

note

Farm needs Node 16.19.0 and above.

Online experience

Edit Farm

Create a Farm Project

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 create farm@latest my-vue-app --template react

2. Start the Project

Choose the package manager you like, then the dependencies will be installed automatically. Then, start the project:

cd farm-project && 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

Refer to Config Reference for more details of configuring Farm.

4. Building the project

Build the Farm project as production-ready static files:

npm run build

The built product is downgraded to ES5 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.

Next Steps

Extremely Fast Web Build Tool Written in Rust

Copyright © 2024 Farm Community. Built with Docusaurus.