mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-11-21 01:13:16 +08:00
57 lines
1.1 KiB
JavaScript
57 lines
1.1 KiB
JavaScript
const vuePlugin = require('rollup-plugin-vue')
|
|
const cssRenderPlugin = require('./build/rollup-plugin-css-render')
|
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
|
const { terser } = require('rollup-plugin-terser')
|
|
const replace = require('@rollup/plugin-replace')
|
|
|
|
function externalValidator (patterns) {
|
|
return id => patterns.some(pattern => id.startsWith(pattern))
|
|
}
|
|
|
|
module.exports = {
|
|
input: 'src/index.js',
|
|
output: [
|
|
{
|
|
format: 'cjs',
|
|
dir: 'lib',
|
|
exports: 'named',
|
|
preserveModules: true
|
|
},
|
|
{
|
|
format: 'esm',
|
|
dir: 'es',
|
|
preserveModules: true
|
|
}
|
|
],
|
|
plugins: [
|
|
replace({
|
|
__DEV__: 'process.env.NODE_ENV !== "production"'
|
|
}),
|
|
nodeResolve({
|
|
extensions: ['.js', '.json', '.vue']
|
|
}),
|
|
cssRenderPlugin(),
|
|
vuePlugin(),
|
|
terser({
|
|
mangle: false,
|
|
output: {
|
|
beautify: true,
|
|
indent_level: 2
|
|
}
|
|
})
|
|
],
|
|
external: externalValidator([
|
|
'async-validator',
|
|
'date-fns',
|
|
'lodash-es',
|
|
'vue',
|
|
'treemate',
|
|
'css-render',
|
|
'@css-render/plugin-bem',
|
|
'vueuc',
|
|
'vooks',
|
|
'evtd',
|
|
'vdirs'
|
|
])
|
|
}
|