mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 19:28:14 +08:00
ccaddca6b4
- Prevent transformer to transform @element-plus/icons
24 lines
583 B
TypeScript
24 lines
583 B
TypeScript
import path from 'path'
|
|
import type { Plugin } from 'rollup'
|
|
|
|
export default function entryPlugin(): Plugin {
|
|
return {
|
|
name: 'element-plus-entry-plugin',
|
|
transform(code, id) {
|
|
if (id.includes('packages')) {
|
|
return {
|
|
code: code.replace(
|
|
/@element-plus\/(components|directives|utils|hooks|tokens|locale)/g,
|
|
`${path.relative(
|
|
path.dirname(id),
|
|
path.resolve(__dirname, '../packages')
|
|
)}/$1`
|
|
),
|
|
map: null,
|
|
}
|
|
}
|
|
return { code, map: null }
|
|
},
|
|
}
|
|
}
|