### Install Dependencies and Start Project Source: https://github.com/farm-fe/farm/blob/main/website/docs/quick-start.mdx After creating the project, navigate to the project directory, install dependencies, and start the development server. The project will be available at http://localhost:9000 by default. ```bash cd farm-app && pnpm install && pnpm dev ``` -------------------------------- ### Install and Start Farm Project Source: https://github.com/farm-fe/farm/blob/main/packages/core/README.md Use this command to create a new Farm project and start the development server. ```sh pnpm create farm && cd farm-project && pnpm start ``` -------------------------------- ### Install Vue Example Dependencies Source: https://github.com/farm-fe/farm/blob/main/docs/superpowers/plans/2026-05-30-plugin-vue-jsx.md Install dependencies for the Vue example, linking workspace packages without a full rebuild. ```bash cd examples/vue && pnpm install --filter @farmfe-examples/vue... && cd ../.. ``` -------------------------------- ### Start Farm Dev Server Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/cli.md Examples for starting the Farm development server. You can specify a root directory, use a custom config file, or customize port and browser opening behavior. ```bash farm # start from current directory farm ./my-app # start from a subdirectory farm -c farm.custom.config.ts # use a custom config file farm --port 3000 --open # custom port + open browser farm --lazy # enable lazy compilation ``` -------------------------------- ### Build a Single Example Source: https://github.com/farm-fe/farm/blob/main/docs/experiences/example-testing-guide.md Use this command to build and test a specific example. Ensure dependencies are installed and run from the repository root. The `--skip-build-js-plugins` flag can speed up validation for non-JS plugin changes. ```bash node scripts/test-examples.mjs --skip-build-js-plugins --example rust-plugin-wasm ``` -------------------------------- ### Solid Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use the Solid plugin. Ensure 'vite-plugin-solid' is installed and imported. ```typescript import solidPlugin from 'vite-plugin-solid'; export default defineConfig({ vitePlugins: [solidPlugin()], }); ``` -------------------------------- ### Run E2E Tests from a Specific Example Onward Source: https://github.com/farm-fe/farm/blob/main/e2e/README.md Start running E2E tests from a designated example and continue with subsequent ones. This is useful for testing a sequence of examples. ```bash pnpm run test-e2e -- --from ``` ```bash # Also works with --start-from ``` -------------------------------- ### React Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use the React plugin. Ensure '@farmfe/plugin-react' is installed. ```typescript import { defineConfig } from '@farmfe/core'; export default defineConfig({ plugins: ['@farmfe/plugin-react'], }); ``` -------------------------------- ### Build Examples from a Specific Point Source: https://github.com/farm-fe/farm/blob/main/docs/experiences/example-testing-guide.md This command builds a specified example and all subsequent examples in the sorted list. It's useful for testing a range of examples. The `--skip-build-js-plugins` flag is recommended for faster iteration on non-JS plugin related changes. ```bash node scripts/test-examples.mjs --skip-build-js-plugins --from rust-plugin-wasm ``` -------------------------------- ### Example .env file Source: https://github.com/farm-fe/farm/blob/main/website/docs/features/env.md Define environment variables in a .env file. Farm loads variables starting with FARM_ or VITE_ into process.env and defines. ```js // .env FARM_APP_SECRET=secret Farm_APP_PASSWORD=password APP_VERSION=1.0.0 ``` -------------------------------- ### start Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/javascript-api.mdx Starts the Farm dev server. It resolves config in `dev` / `development` mode, creates the server, starts listening, compiles the project, and prints server URLs. ```APIDOC ## start ### Description Starts the Farm dev server. It resolves config in `dev` / `development` mode, creates the server, starts listening, compiles the project, and prints server URLs. ### Signature ```ts start(options?: FarmCliOptions & UserConfig): Promise ``` ### Example ```ts import { start } from '@farmfe/core'; import react from '@farmfe/plugin-react'; await start({ compilation: { input: { index: './index.html' }, output: { publicPath: '/dist/' } }, server: { port: 6532 }, plugins: [react()] }); ``` ``` -------------------------------- ### Setup Server Proxy Source: https://github.com/farm-fe/farm/blob/main/website/docs/tutorials/2-start.md Configure a development server proxy to forward requests to a target API. This example uses http-proxy to proxy '/api' requests to a music API. ```typescript import { defineConfig } from "@farmfe/core"; export default defineConfig({ server: { proxy: { "/api": { target: "https://music-erkelost.vercel.app/banner", changeOrigin: true, pathRewrite: (path: any) => path.replace(/^\/api/, ""), }, }, }, }); ``` -------------------------------- ### Electron Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use the Electron plugin. Ensure '@farmfe/js-plugin-electron' is installed and imported. Options can be passed to the plugin. ```typescript import electron from '@farmfe/js-plugin-electron'; export default defineConfig({ plugins: [electron({ /* options */ })], }); ``` -------------------------------- ### Start Client Dev Server and Watch Server Source: https://github.com/farm-fe/farm/blob/main/examples/solid-ssr/README.md Use these commands to start the client development server and compile/watch the server in development mode. Visit http://localhost:9000 after starting. ```sh npm start; # start the client dev server npm run watch; # compile and watch the server procution in development mode ``` -------------------------------- ### Create Farm Project with NPM Source: https://github.com/farm-fe/farm/blob/main/packages/create-farm/README.md Use this command to start a new Farm project interactively with NPM. Ensure Node.js version 16+ is installed. ```bash $ npm create farm@latest ``` -------------------------------- ### Create Farm Project with PNPM Source: https://github.com/farm-fe/farm/blob/main/packages/create-farm/README.md Use this command to start a new Farm project interactively with PNPM. Ensure Node.js version 16+ is installed. ```bash $ pnpm create farm ``` -------------------------------- ### Farm Key Commands Source: https://github.com/farm-fe/farm/blob/main/AGENTS.md Essential commands for managing the Farm project, including setup, testing, linting, and example validation. ```text Command | Purpose | ---------------------- | ----------------------------------------------------------- | `pnpm bootstrap` | First-time setup: install deps + build core packages | `pnpm run ready` | Full CI gate — install, clean, build, all tests (see below) | `pnpm run test` | Unit tests (vitest) | `cargo test` | Rust unit tests | `pnpm run test-e2e` | Playwright E2E tests | `node scripts/test-examples.mjs --skip-build-js-plugins --example ` | Build and validate one example only. | `pnpm run check` | Biome lint + format | `cargo clippy` | Rust linter | `pnpm run spell-check` | cspell across all files | ``` -------------------------------- ### Install @farmfe/js-plugin-react-compiler with yarn Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-react-compiler.mdx Install the plugin using yarn. ```bash yarn add @farmfe/js-plugin-react-compiler --dev ``` -------------------------------- ### Install @farmfe/js-plugin-react-compiler with npm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-react-compiler.mdx Install the plugin using npm. ```bash npm install @farmfe/js-plugin-react-compiler --save-dev ``` -------------------------------- ### Install @farmfe/plugin-icons with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/icons.mdx Install the plugin using pnpm. ```bash pnpm add -D @farmfe/plugin-icons ``` -------------------------------- ### Install @farmfe/js-plugin-react-compiler with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-react-compiler.mdx Install the plugin using pnpm. ```bash pnpm add @farmfe/js-plugin-react-compiler --save-dev ``` -------------------------------- ### Install @farmfe/plugin-icons with npm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/icons.mdx Install the plugin using npm. ```bash npm install -D @farmfe/plugin-icons ``` -------------------------------- ### Install @farmfe/plugin-icons with yarn Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/icons.mdx Install the plugin using yarn. ```bash yarn add -D @farmfe/plugin-icons ``` -------------------------------- ### Start Farm Dev Server Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/javascript-api.mdx Starts the Farm dev server. It resolves config in dev mode, creates the server, starts listening, compiles the project, and prints server URLs. ```typescript import { start } from '@farmfe/core'; import react from '@farmfe/plugin-react'; await start({ compilation: { input: { index: './index.html' }, output: { publicPath: '/dist/' } }, server: { port: 6532 }, plugins: [react()] }); ``` -------------------------------- ### Install Visualizer Plugin Source: https://github.com/farm-fe/farm/blob/main/js-plugins/visualizer/README.md Install the @farmfe/visualizer plugin as a development dependency. ```bash npm install @farmfe/visualizer --save-dev ``` ```bash yarn add -D @farmfe/visualizer ``` ```bash pnpm add -D @farmfe/visualizer ``` -------------------------------- ### Build for Production and Run Server Source: https://github.com/farm-fe/farm/blob/main/examples/solid-ssr/README.md Build both the client and server for production, then launch the production server. Visit http://localhost:3000 after launching. ```sh npm run build && npm run build:server NODE_ENV=production node server.js ``` -------------------------------- ### Bootstrap Hook Example Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/runtime-plugin-api.md Example of implementing the bootstrap hook to initialize HmrClient when the module system starts. ```typescript export default { name: 'farm-runtime-hmr-client-plugin', // define hooks bootstrap(moduleSystem) { hmrClient = new HmrClient(moduleSystem); hmrClient.connect(); }, }; ``` -------------------------------- ### Build Vue Example Source: https://github.com/farm-fe/farm/blob/main/docs/superpowers/plans/2026-05-30-plugin-vue-jsx.md Build the Vue example project. Expected output in the 'build/' directory. ```bash cd examples/vue && pnpm run build ``` -------------------------------- ### Preview Farm Build Products Source: https://github.com/farm-fe/farm/blob/main/website/docs/quick-start.mdx Start a local preview server for your production build artifacts. ```bash npm run preview ``` -------------------------------- ### Instantiate and Manage Server Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/javascript-api.md Create a `Server` instance, initialize the dev server with options, start listening, and close the server. ```typescript const server = new Server({ compiler }); await server.createDevServer(options); server.listen(); await server.close(); const compiler = server.getCompiler(); ``` -------------------------------- ### Start Development Server Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/javascript-api.md Use the `start` function to initiate the development server. Configure compilation inputs, server port, HMR path, and plugins. ```typescript await start({ compilation: { input: { index: './index.html' } }, server: { port: 3000, hmr: { path: '/__farm_hmr' } }, plugins: ['@farmfe/plugin-react'], }); ``` -------------------------------- ### Install @farmfe/plugin-image with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/image.mdx Use this command to install the plugin using pnpm. ```bash pnpm add @farmfe/plugin-image ``` -------------------------------- ### Preact Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use the Preact preset. Ensure '@preact/preset-vite' is installed and imported. ```typescript import preact from '@preact/preset-vite'; export default defineConfig({ vitePlugins: [preact()], }); ``` -------------------------------- ### Launch Farm Development Server Source: https://github.com/farm-fe/farm/blob/main/website/docs/tutorials/1-create.md Run the 'npm start' command to build and serve your Farm project. Check the console output for success messages and URLs. ```text $ npm start > 1-create-a-project@1.0.0 start > farm start [ Farm ] Using config file at /home/tutorials/1-create-a-project/farm.config.ts ϟ Farm v0.16.0 ✓ Ready in 20ms ⚡️ FULL EXTREME ! [ Farm ] > Local: http://localhost:9000/ [ Farm ] > Network: http://192.168.1.3:9000/ ``` -------------------------------- ### Svelte Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use the Svelte plugin. Ensure '@sveltejs/vite-plugin-svelte' is installed and imported. ```typescript import { svelte } from '@sveltejs/vite-plugin-svelte'; export default defineConfig({ vitePlugins: [svelte()], }); ``` -------------------------------- ### Vue 3 Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use the Vue 3 plugin. Ensure '@vitejs/plugin-vue' is installed and imported. ```typescript import { defineConfig } from '@farmfe/core'; import vue from '@vitejs/plugin-vue'; export default defineConfig({ vitePlugins: [vue()], }); ``` -------------------------------- ### Start Client Development Server Source: https://github.com/farm-fe/farm/blob/main/examples/react-ssr/README.md Use this command to start the client-side development server for live updates. ```sh npm start; # start the client dev server ``` -------------------------------- ### renderStart Hook Example Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/js-plugin-api.md This hook is called before resources start rendering. It is only triggered once for the initial compilation, not for subsequent updates like HMR. ```typescript const myPlugin = () => { // your plugin operations let myPluginContext = createMyPluginContext(); return { name: 'my-plugin', renderStart: { async executor() { // update my plugin status myPluginContext.updateStatus('render-start'); } } } } ``` -------------------------------- ### Server.createServer Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/javascript-api.mdx Creates and initializes a development server. Call `listen()` to start the HTTP server and initial compilation. ```APIDOC ## Server.createServer ### Description Creates and initializes a development server. Call `listen()` to start the HTTP server and initial compilation. ### Signature ```ts Server.createServer(options?: FarmCliOptions & UserConfig): Promise ``` ### Example ```ts import { Server } from '@farmfe/core'; const server = await Server.createServer({ server: { port: 9000 } }); await server.listen(); ``` ``` -------------------------------- ### Start Development Server Source: https://github.com/farm-fe/farm/blob/main/examples/vue-ssr/README.zh-CN.md Use 'npm start' to launch the development server. Use 'npm run watch' to bundle the SSR server entry point in development mode. Ensure 'compilation.lazyCompilation' is set to 'false' in farm configuration when compiling the server entry point. ```sh npm start; # 启动开发服务器 npm run watch; # 以 development 打包 SSR 服务端入口 ``` ```js export default { input: { index: 'server.ts' }, compilation: { lazyCompilation: false } }; ``` -------------------------------- ### Preview Production Build Source: https://github.com/farm-fe/farm/blob/main/website/docs/cli/cli-api.md Serves an existing production build for local preview. Ensure `farm build` is run first. Options include specifying the host, port, whether to open the browser, and the directory to serve. ```bash farm preview [root] ``` -------------------------------- ### Create Farm Project with Yarn Source: https://github.com/farm-fe/farm/blob/main/packages/create-farm/README.md Use this command to start a new Farm project interactively with Yarn. Ensure Node.js version 16+ is installed. ```bash $ yarn create farm ``` -------------------------------- ### Start Farm Development Server Source: https://github.com/farm-fe/farm/blob/main/website/README.md Execute this command to start the local development server for the Farm project. ```bash npm start ``` -------------------------------- ### Vue 3 + JSX Project Setup Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/recipes.md Configure Farm to use both Vue 3 and Vue JSX plugins. Ensure '@vitejs/plugin-vue' and '@vitejs/plugin-vue-jsx' are installed and imported. ```typescript import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; export default defineConfig({ vitePlugins: [vue(), vueJsx()], }); ``` -------------------------------- ### Start Development Server with pnpm Source: https://github.com/farm-fe/farm/blob/main/crates/create-farm-rs/templates/electron/solid/README.md Use this command to start the development server for live reloading and testing. ```bash pnpm start ``` -------------------------------- ### Start Farm Development Server Source: https://github.com/farm-fe/farm/blob/main/website/docs/config/cli.md Launches a development server to compile your Farm project and watch for file changes. ```bash farm start ``` -------------------------------- ### Minimal JS Plugin Example Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/writing-plugins.md A basic JS plugin structure. It defines a factory function that returns a JsPlugin object with a name and priority. Use this as a starting point for custom integrations. ```typescript import type { JsPlugin } from '@farmfe/core'; export interface MyPluginOptions { enable?: boolean; } export default function myPlugin(options: MyPluginOptions = {}): JsPlugin { return { name: 'my-plugin', // required; must be non-empty priority: 100, // optional; default 100. Higher = earlier. Internal plugins = 99. //hooks... }; } ``` -------------------------------- ### Start Development Server for Farm Solid SSR Source: https://github.com/farm-fe/farm/blob/main/examples/solid-ssr/README.zh-CN.md Use 'npm start' to launch the development server for Solid SSR. Use 'npm run watch' to package the SSR server entry point in development mode. Ensure 'compilation.lazyCompilation' is set to 'false' in Farm configuration when compiling the server entry point. ```sh npm start; # 启动开发服务器 npm run watch; # 以 development 打包 SSR 服务端入口 ``` ```js export default { input: { index: 'server.tsx' }, compilation: { lazyCompilation: false } }; ``` -------------------------------- ### Example: Target specific functions for removal Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/strip.mdx Configure the 'functions' option to specify an array of function names to be removed. Note that removing functions at the start of a chain may cause runtime errors. ```javascript functions: [ 'console.log', 'MyClass.Test' ], ``` -------------------------------- ### Rust Plugin: Implement config Hook Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/rust-plugin-api.md Example implementation of the `config` hook for a Rust plugin. This hook allows modifying the compilation configuration before the build starts. It can be used to add custom entry points or change other config options. ```rust impl Plugin for MyPlugin { // implement config hook fn config(&self, config: &mut Config) -> Result> { // set minify to false config.input.insert("custom-entry", "./custom.html"); Ok(Some(())) } } ``` -------------------------------- ### `farm start` / `farm [root]` Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/cli.md Starts the development server and compiles in development mode. You can specify a root directory or use common flags. ```APIDOC ## `farm start` / `farm [root]` Start the dev server and compile in development mode. ### Usage Examples - `farm` - Start from the current directory. - `farm ./my-app` - Start from a subdirectory. - `farm -c farm.custom.config.ts` - Use a custom config file. - `farm --port 3000 --open` - Use a custom port and open the browser on start. - `farm --lazy` - Enable lazy compilation. ``` -------------------------------- ### Run Farm Development Server Source: https://github.com/farm-fe/farm/blob/main/website/docs/migration/from-vite.md Start the Farm development server to test your migrated project. ```bash npx farm dev ``` -------------------------------- ### Install @farmfe/plugin-image Source: https://github.com/farm-fe/farm/blob/main/rust-plugins/image/README.md Install the image plugin using npm. This command installs the package and adds it to your project's dependencies. ```bash npm i @farmfe/plugin-image ``` -------------------------------- ### Install Svgr Plugin with pnpm Source: https://github.com/farm-fe/farm/blob/main/js-plugins/svgr/README.md Install the Svgr plugin using pnpm. This is another package manager option for installing the plugin. ```bash pnpm add -D @farmfe/js-plugin-svgr ``` -------------------------------- ### preview Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/javascript-api.mdx Starts a preview server for existing production assets. ```APIDOC ## preview ### Description Starts a preview server for existing production assets. ### Signature ```ts preview(options?: FarmCliOptions & UserConfig): Promise ``` ### Example ```ts import { preview } from '@farmfe/core'; await preview({ server: { preview: { port: 9000, distDir: 'dist' } } }); ``` ``` -------------------------------- ### Preview Production Build Source: https://github.com/farm-fe/farm/blob/main/examples/rust-plugin-auto-import-vue/README.md Serves the production build locally to preview the final product. ```bash pnpm preview ``` -------------------------------- ### Install @farmfe/plugin-yaml with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/yaml.mdx Install the plugin using pnpm. ```bash pnpm add @farmfe/plugin-yaml ``` -------------------------------- ### Add Start Script to package.json Source: https://github.com/farm-fe/farm/blob/main/website/docs/tutorials/1-create.md Add a 'start' script to your package.json to easily launch the Farm development server. ```json { "name": "1-create-a-project", "version": "1.0.0", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "farm start" }, // ... ignore other fields } ``` -------------------------------- ### Install @farmfe/plugin-yaml with yarn Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/yaml.mdx Install the plugin using yarn. ```bash yarn add @farmfe/plugin-yaml ``` -------------------------------- ### Configure Assets Include Source: https://github.com/farm-fe/farm/blob/main/website/docs/config/compilation-options.md Specify additional file suffixes to be treated as static resources. This example includes '.txt' files. ```typescript export default defineConfig({ compilation: { assets: { include: ["txt"], }, }, }); ``` -------------------------------- ### Install @farmfe/plugin-yaml with npm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/yaml.mdx Install the plugin using npm. ```bash npm install @farmfe/plugin-yaml ``` -------------------------------- ### Initialize a New Farm Project Package Source: https://github.com/farm-fe/farm/blob/main/website/docs/tutorials/1-create.md Execute this command to create a new directory and initialize a package.json file for your Farm project. ```bash mkdir farm-react && cd farm-react && pnpm init ``` -------------------------------- ### Install React and Development Dependencies Source: https://github.com/farm-fe/farm/blob/main/website/docs/tutorials/1-create.md Install React, ReactDOM, and necessary development dependencies for hot module replacement. ```bash pnpm add react react-dom && pnpm add react-refresh @types/react @types/react-dom -D ``` -------------------------------- ### Preview Built Resources Source: https://github.com/farm-fe/farm/blob/main/website/docs/tutorials/3-build.md Use the 'farm preview' command to serve your production build locally for testing. This command starts a development server to preview the built assets. ```sh $ npm run preview > 3-build@1.0.0 preview > farm preview [ Farm ] Using config file at /root/tutorials/3-build-for-production/farm.config.ts [ Farm ] preview server running at: [ Farm ] > Local: http://localhost:1911/ [ Farm ] > Network: http://198.18.0.1:1911/ [ Farm ] > Network: http://10.242.197.146:1911/ [ Farm ] > Network: http://192.168.1.31:1911/ ``` -------------------------------- ### Build for Production Source: https://github.com/farm-fe/farm/blob/main/examples/rust-plugin-auto-import-vue/README.md Compiles and bundles the application for production deployment. ```bash pnpm build ``` -------------------------------- ### Install Farm Compilation Plugins Source: https://github.com/farm-fe/farm/blob/main/website/docs/using-plugins.mdx Install necessary plugins like Sass and PostCSS using pnpm. ```bash pnpm add -D @farmfe/plugin-sass @farmfe/js-plugin-postcss ``` -------------------------------- ### Install CSS Preprocessor Plugins Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/features.md To use Sass/SCSS, Less, or PostCSS, install the corresponding Farm plugin and any necessary peer dependencies. ```bash # Sass / SCSS pnpm add -D @farmfe/plugin-sass # Less pnpm add -D @farmfe/js-plugin-less less # PostCSS pnpm add -D @farmfe/js-plugin-postcss postcss ``` -------------------------------- ### Install @farmfe/js-plugin-svgr with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-svgr.mdx Install the plugin using pnpm. ```bash pnpm add @farmfe/js-plugin-svgr ``` -------------------------------- ### Install Farm Dependencies Source: https://github.com/farm-fe/farm/blob/main/website/README.md Run this command to install all necessary project dependencies using pnpm. ```bash pnpm i ``` -------------------------------- ### Install @farmfe/js-plugin-svgr with yarn Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-svgr.mdx Install the plugin using yarn. ```bash yarn add @farmfe/js-plugin-svgr ``` -------------------------------- ### Install @farmfe/js-plugin-svgr with npm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-svgr.mdx Install the plugin using npm. ```bash npm install @farmfe/js-plugin-svgr ``` -------------------------------- ### Create Farm Development Server Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/javascript-api.mdx Creates and initializes a development server instance. Call `listen()` to start the HTTP server and initial compilation. ```typescript import { Server } from '@farmfe/core'; const server = await Server.createServer({ server: { port: 9000 } }); await server.listen(); ``` -------------------------------- ### Install @farmfe/js-plugin-dts with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-dts.mdx Install the plugin using pnpm. ```bash pnpm add @farmfe/js-plugin-dts ``` -------------------------------- ### Install @farmfe/js-plugin-dts with yarn Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-dts.mdx Install the plugin using yarn. ```bash yarn add @farmfe/js-plugin-dts ``` -------------------------------- ### Install @farmfe/js-plugin-dts with npm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-dts.mdx Install the plugin using npm. ```bash npm install @farmfe/js-plugin-dts ``` -------------------------------- ### Preview Farm Project Build Source: https://github.com/farm-fe/farm/blob/main/website/docs/config/cli.md Serves the output of the `farm build` command for previewing. ```bash farm build && farm preview ``` -------------------------------- ### Install React Compiler Plugin Source: https://github.com/farm-fe/farm/blob/main/js-plugins/react-compiler/README.md Install the plugin using npm, yarn, or pnpm. ```shell npm i @farmfe/js-plugin-react-compiler -D ``` ```shell pnpm i @farmfe/js-plugin-react-compiler -D ``` -------------------------------- ### Install @farmfe/plugin-worker Source: https://github.com/farm-fe/farm/blob/main/rust-plugins/worker/README.md Install the worker plugin as a development dependency. ```bash npm i -D @farmfe/plugin-worker ``` -------------------------------- ### Hook Example: configureDevServer Source: https://github.com/farm-fe/farm/blob/main/skills/farmfe-guide/references/js-plugin-api.md Example of using the `configureDevServer` hook to access and interact with the development server instance. ```APIDOC ### `configureDevServer` — Access Dev Server ```ts configureDevServer(server) { // server is the Farm Server instance console.log('Dev server ready:', server); }, ``` ``` -------------------------------- ### Install Plugin Source: https://github.com/farm-fe/farm/blob/main/rust-plugins/icons/README.md Install the @farmfe/plugin-icons package as a development dependency. ```bash npm i -D @farmfe/plugin-icons ``` -------------------------------- ### Run a Single Example E2E Test Source: https://github.com/farm-fe/farm/blob/main/e2e/README.md Execute a specific E2E test case by providing the example name. This command filters tests to run only the specified example. ```bash pnpm run test-e2e -- --example ``` ```bash # Or use project alias: pnpm run test-e2e -- --project ``` -------------------------------- ### Create and Run a Compiler Source: https://github.com/farm-fe/farm/blob/main/website/docs/api/javascript-api.mdx Create a compiler instance from a resolved configuration and execute a build compilation. Ensure you have resolved the configuration first. ```typescript import { createCompiler, resolveConfig } from '@farmfe/core'; const config = await resolveConfig({}, 'build', 'production'); const compiler = createCompiler(config); await compiler.compile(); ``` -------------------------------- ### Install @farmfe/plugin-virtual with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/virtual.mdx Install the virtual plugin using pnpm. ```bash pnpm add @farmfe/plugin-virtual ``` -------------------------------- ### Install Electron Plugin with npm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-electron.mdx Install the Electron plugin and Electron using npm. ```bash npm install @farmfe/js-plugin-electron electron ``` -------------------------------- ### Install Electron Plugin with pnpm Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/js-electron.mdx Install the Electron plugin and Electron using pnpm. ```bash pnpm add @farmfe/js-plugin-electron electron ``` -------------------------------- ### Install @farmfe/plugin-virtual with yarn Source: https://github.com/farm-fe/farm/blob/main/website/docs/plugins/official-plugins/virtual.mdx Install the virtual plugin using yarn. ```bash yarn add @farmfe/plugin-virtual ```