0.4.2 β’ Published 2 years ago
unplugin-dsv3 v0.4.2
unplugin-dsv3
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-dsv3 -D
// vite.config.ts
import dsv3 from 'unplugin-dsv3/vite'
export default {
plugins: [
dsv3({
// options
}),
],
}
// rollup.config.js
import dsv3 from 'unplugin-dsv3/rollup'
export default {
plugins: [
dsv3({
// options
}),
],
}
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [
require('unplugin-dsv3/esbuild')({
// options
}),
],
})
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-dsv3/webpack')({
// options
}),
],
}
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-dsv3/webpack')({
// options
}),
],
},
}
Usage
It will automatically transform:
import { ElButton } from '@bigin/dsv3'
// β β β β β β
import { ElButton } from '@bigin/dsv3'
import '@bigin/dsv3/es/components/button/style/css'
Options
useSource
type UseSource = boolean
default: false
// useSource: false
import { ElButton } from '@bigin/dsv3'
// β β β β β β
import { ElButton } from '@bigin/dsv3'
import '@bigin/dsv3/es/components/button/style/css'
// useSource: true
import { ElButton } from '@bigin/dsv3'
// β β β β β β
import { ElButton } from '@bigin/dsv3'
import '@bigin/dsv3/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 dsv3. See unpkg.com for more information.
type Lib = string
default: '@bigin/dsv3'
// 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/*
/es
for ES Module/lib
for CommonJS
This option is for which format to use
// format: 'cjs'
import { ElButton } from '@bigin/dsv3'
// β β β β β β
import { ElButton } from '@bigin/dsv3'
import '@bigin/dsv3/lib/components/button/style/css'
prefix
type Prefix = string
// prefix = Al
import { AlButton } from 'xx-lib'
defaultLocale
Replace default locale, you can find locale list here.
Alternate
0.4.2
2 years ago