$ cnpm install unplugin-element-plus
This repo is for element-plus related unplugin. Thanks @antfu.
npm i unplugin-element-plus -D
// vite.config.ts
import ElementPlus from 'unplugin-element-plus/vite'
export default {
plugins: [
ElementPlus({
// options
}),
],
}
// rollup.config.js
import ElementPlus from 'unplugin-element-plus/rollup'
export default {
plugins: [
ElementPlus({
// options
}),
],
}
// rolldown.config.js
import ElementPlus from 'unplugin-element-plus/rolldown'
export default {
plugins: [
ElementPlus({
// options
}),
],
}
// esbuild.config.js
import { build } from 'esbuild'
import ElementPlus from 'unplugin-element-plus/esbuild'
build({
plugins: [
ElementPlus({
// options
}),
],
})
// webpack.config.js
import ElementPlus from 'unplugin-element-plus/webpack'
export default {
/* ... */
plugins: [
ElementPlus({
// options
}),
],
}
// rspack.config.js
import ElementPlus from 'unplugin-element-plus/rspack'
export default {
/* ... */
plugins: [
ElementPlus({
// options
}),
],
}
It will automatically transform:
import { ElButton } from 'element-plus'
// ↓ ↓ ↓ ↓ ↓ ↓
import { ElButton } from 'element-plus'
import 'element-plus/es/components/button/style/css'
useSourcetype UseSource = boolean
default: false
// useSource: false
import { ElButton } from 'element-plus'
// ↓ ↓ ↓ ↓ ↓ ↓
import { ElButton } from 'element-plus'
import 'element-plus/es/components/button/style/css'
// useSource: true
import { ElButton } from 'element-plus'
// ↓ ↓ ↓ ↓ ↓ ↓
import { ElButton } from 'element-plus'
import 'element-plus/es/components/button/style/index'
libNormally you wouldn't use this option but as a general option we exposed it anyway. When using this your bundle structure should be the same as ElementPlus. See unpkg.com for more information.
type Lib = string
default: 'element-plus'
// lib: 'other-lib'
import { ElButton } from 'other-lib'
// ↓ ↓ ↓ ↓ ↓ ↓
import { ElButton } from 'other-lib'
import 'other-lib/es/components/button/style/css'
formattype Format = 'esm' | 'cjs'
default: 'esm'
esm for element-plus/es/components/*
cjs for element-plus/lib/components/*
/es for ES Module/lib for CommonJSThis option is for which format to use
// format: 'cjs'
import { ElButton } from 'element-plus'
// ↓ ↓ ↓ ↓ ↓ ↓
import { ElButton } from 'element-plus'
import 'element-plus/lib/components/button/style/css'
prefixtype Prefix = string
// prefix = Al
import { AlButton } from 'xx-lib'
ignoreComponentstype IgnoreComponents = string[]
Skip style imports for a list of components. Useful for Element Plus components which do not have a style file.
At the time of writing, this is only the AutoResizer component.
// format: 'cjs'
import { ElAutoResizer } from 'element-plus'
// ↓ ↓ ↓ ↓ ↓ ↓
import { ElAutoResizer } from 'element-plus'
defaultLocaleReplace default locale, you can find locale list here.
Copyright 2013 - present © cnpmjs.org | Home |