element-plus/unplugin-element-plus
์๊ฐ
๐ Import Element Plus on demand. Support Vite, Webpack, Vue CLI, Rollup and esbuild.
์น ๋ฐ ์ฑ ๊ฐ๋ฐ์ธก์ ๋ ์คํ ์ฆ๊ฐ
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- ๊ธฐ๋ก ์์ง ์ค
์๋ก ๊ฒน์น๋ ๊ธฐ๊ฐ์ ์์ฆ๊ฐ๋์ด๋ฉฐ ์ผ๋ณ ํฉ๊ณ๊ฐ ์๋๋๋ค. ์ธก์ ๊ฐ์ด ์์ผ๋ฉด ๋น์ ๋ก๋๋ค. ์คํ๋ ๊ด์ฌ๋๋ฅผ ๋ํ๋ด๋ฉฐ ํ์ง์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
README.md
Original
unplugin-element-plus
This repo is for element-plus related unplugin. Thanks @antfu.
Features
- ๐ On-demand import style for Element Plus.
- ๐ Replace default locale.
- โก๏ธ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.
Installation
npm i unplugin-element-plus -D
Vite
// vite.config.ts
import ElementPlus from 'unplugin-element-plus/vite'
export default {
plugins: [
ElementPlus({
// options
}),
],
}
Rollup
// rollup.config.js
import ElementPlus from 'unplugin-element-plus/rollup'
export default {
plugins: [
ElementPlus({
// options
}),
],
}
Rolldown
// rolldown.config.js
import ElementPlus from 'unplugin-element-plus/rolldown'
export default {
plugins: [
ElementPlus({
// options
}),
],
}
esbuild
// esbuild.config.js
import { build } from 'esbuild'
import ElementPlus from 'unplugin-element-plus/esbuild'
build({
plugins: [
ElementPlus({
// options
}),
],
})
Webpack
// webpack.config.js
import ElementPlus from 'unplugin-element-plus/webpack'
export default {
/* ... */
plugins: [
ElementPlus({
// options
}),
],
}
Rspack
// rspack.config.js
import ElementPlus from 'unplugin-element-plus/rspack'
export default {
/* ... */
plugins: [
ElementPlus({
// options
}),
],
}
Usage
It will automatically transform:
import { ElButton } from 'element-plus'
// โ โ โ โ โ โ
import { ElButton } from 'element-plus'
import 'element-plus/es/components/button/style/css'
Options
useSource
type 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'
lib
Normally 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'
format
type Format = 'esm' | 'cjs'
default: 'esm'
esm for element-plus/es/components/*
cjs for element-plus/lib/components/*
/esfor ES Module/libfor CommonJS
This 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'
prefix
type Prefix = string
// prefix = Al
import { AlButton } from 'xx-lib'
ignoreComponents
type 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'
defaultLocale
Replace default locale, you can find locale list here.
Alternate
๊ด๋ จ ํ๋ก์ ํธ ์ดํด๋ณด๊ธฐ
๋ถ๋ฌ์ค๋ ์คโฆ