Modular UI library build plugin for Farm.
npm i -D @farmfe/plugin-modular-import
Via farm.config.ts
.
import { defineConfig } from '@farmfe/core';
export default defineConfig({
plugins: [
["@farmfe/plugin-modular-import", {
/**
* zie of zooming icon
* @type {string}
* @default lib
*/
libDir: 'lib',
/**
* @description The components lib directory
* @type {string}
*/
libraryName: "",
/**
* @description The UI library name
* @type {boolean}
* @default true
*/
camel2Dash: true,
/**
* @description style lib directory, default "lib"
* @type {string}
* @default lib
*/
styleLibDir: 'lib',
/**
* @description the style library name. e.g. custon-theme => custon-theme/index.css
* @type {string}
*/
styleLibraryName: '',
/**
* @description custom style path
* @type {string}
* @default index.css
*/
styleLibraryPath: 'index.css',
}],
],
});
export default defineConfig({
plugins: [
['@farmfe/plugin-modular-import', {
libraryName: 'element-ui',
}]
],
});
import { SomeComponent } from 'element-ui'
import SomeComponent from 'element-ui/lib/SomeComponent';
import 'element-ui/lib/SomeComponent/index.css';
export default defineConfig({
plugins: [
['@farmfe/plugin-modular-import', {
libraryName: 'element-ui',
libDir: 'es',
}]
],
});
import { SomeComponent } from 'element-ui'
import SomeComponent from 'element-ui/es/SomeComponent';
import 'element-ui/lib/SomeComponent/index.css';
export default defineConfig({
plugins: [
['@farmfe/plugin-modular-import', {
libraryName: 'element-ui',
libDir: 'es',
camel2Dash: false,
}]
],
});
import { SomeComponent } from 'element-ui'
import SomeComponent from 'element-ui/es/someComponent';
import 'element-ui/lib/someComponent/index.css';
export default defineConfig({
plugins: [
['@farmfe/plugin-modular-import', {
libraryName: 'element-ui',
libDir: 'es',
camel2Dash: false,
styleLibDir: 'lib',
}]
],
});
import { SomeComponent } from 'element-ui'
import SomeComponent from 'element-ui/es/someComponent';
import 'element-ui/lib/someComponent/index.css';
export default defineConfig({
plugins: [
['@farmfe/plugin-modular-import', {
libraryName: 'element-ui',
libDir: 'es',
camel2Dash: false,
styleLibDir: 'lib',
styleLibraryName: 'theme-default',
}]
],
});
import { SomeComponent } from 'element-ui'
import SomeComponent from 'element-ui/es/someComponent';
import 'element-ui/lib/theme-default/someComponent/index.css';
export default defineConfig({
plugins: [
['@farmfe/plugin-modular-import', {
libraryName: 'element-ui',
libDir: 'es',
camel2Dash: false,
styleLibDir: 'lib',
styleLibraryName: 'theme-default',
styleLibraryPath: 'style/index.css'
}]
],
});
import { SomeComponent } from 'element-ui'
import SomeComponent from 'element-ui/es/someComponent';
import 'element-ui/lib/theme-default/someComponent/style/index.css';