chore: test rollup-tree-shaking

This commit is contained in:
07akioni 2020-11-11 22:20:28 +08:00
parent 5c21ec4e77
commit 6be5bf0938
2 changed files with 60 additions and 0 deletions

View 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)

View 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'
])
}