mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-23 13:31:06 +08:00
chore: test rollup-tree-shaking
This commit is contained in:
parent
5c21ec4e77
commit
6be5bf0938
28
playground/tree-shaking-test/index.js
Normal file
28
playground/tree-shaking-test/index.js
Normal file
@ -0,0 +1,28 @@
|
||||
// index.js
|
||||
import { createApp } from 'vue'
|
||||
import {
|
||||
create,
|
||||
enUS,
|
||||
Button,
|
||||
Input,
|
||||
buttonLight,
|
||||
inputLight
|
||||
} from '../../es'
|
||||
|
||||
const app = createApp()
|
||||
const naive = create({
|
||||
// install components globally or import it in other component are both ok
|
||||
components: [
|
||||
Button,
|
||||
Input
|
||||
],
|
||||
styles: [
|
||||
buttonLight,
|
||||
inputLight
|
||||
],
|
||||
locales: [
|
||||
enUS
|
||||
]
|
||||
})
|
||||
|
||||
app.use(naive)
|
32
playground/tree-shaking-test/rollup.config.js
Normal file
32
playground/tree-shaking-test/rollup.config.js
Normal file
@ -0,0 +1,32 @@
|
||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||
|
||||
function externalValidator (patterns) {
|
||||
return id => patterns.some(pattern => id.startsWith(pattern))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
input: 'playground/tree-shaking-test/index.js',
|
||||
output: [
|
||||
{
|
||||
format: 'esm',
|
||||
dir: 'dist'
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
nodeResolve({
|
||||
extensions: ['.js']
|
||||
})
|
||||
],
|
||||
external: externalValidator([
|
||||
'async-validator',
|
||||
'date-fns',
|
||||
'lodash-es',
|
||||
'vue',
|
||||
'treemate',
|
||||
'css-render',
|
||||
'@css-render/plugin-bem',
|
||||
'vueuc',
|
||||
'vooks',
|
||||
'evtd'
|
||||
])
|
||||
}
|
Loading…
Reference in New Issue
Block a user