Skip to main content
Version: 0.15

Community Plugins

Farm support Vite/Rollup plugins out of box. So Vite/Rollup or unplugin plugins can be used in Farm directly.

tip

PR welcome if you developed a Farm compatible plugin and you want to list it here.

Current tested compatible Vite/Rollup/unplugin plugins as below:

Vite/Rollup Plugins​

using vitePlugins in farm.config.ts to configure Vite/Rollup plugins.

import { UserConfig } from '@farmfe/core';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';

const config: UserConfig = {
vitePlugins: [
vue(),
vueJsx(),
]
}

unplugin​

note

Currently you can use unplugin/vite or unplugin/rollup in Farm. unplugin/farm will be available when this PR are merged into unplugin

import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
import Components from 'unplugin-vue-components/rollup';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
import { FileSystemIconLoader } from 'unplugin-icons/loaders';

const config: UserConfig = {
vitePlugins: [
Icons({
compiler: 'vue3',
customCollections: {
[collectionName]: FileSystemIconLoader(localIconPath, svg =>
svg.replace(/^<svg\s/, '<svg width="1em" height="1em" ')
)
},
scale: 1,
defaultClass: 'inline-block'
}),
Components({
dts: 'src/typings/components.d.ts',
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
resolvers: [
NaiveUiResolver(),
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
]
})
]
}

All unplugin are supported in Farm:

Extremely Fast Web Build Tool Written in Rust

Copyright © 2024 Farm Community. Built with Docusaurus.