js-plugins/svgr/README-zh-CN.md
支持在 Farm 中将 Svg 编译为 React 组件。
首先,您需要 @farmfe/js-plugin-svgr:
npm install @farmfe/js-plugin-svgr --save-dev
或者
纱线添加-D @farmfe/js-plugin-svgr
或者
pnpm add -D @farmfe/js-plugin-svgr
在 farm.config.ts 中配置插件:
import { UserConfig } from '@farmfe/core';
import svgr from '@farmfe/js-plugin-svgr'; // import the plugin
function defineConfig(config: UserConfig) {
return config;
}
export default defineFarmConfig({
compilation: {
input: {
index: './index.html'
},
output: {
path: './build'
}
},
plugins: [
// 配置 svgr 插件
svgr({
// 指定插件参数
})
]
});