naive-ui/rollup.config.js

56 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-10-31 18:02:14 +08:00
const vuePlugin = require('rollup-plugin-vue')
const cssRenderPlugin = require('./build/rollup-plugin-css-render')
2020-10-31 18:02:14 +08:00
const { nodeResolve } = require('@rollup/plugin-node-resolve')
const { terser } = require('rollup-plugin-terser')
2020-11-03 14:05:05 +08:00
const replace = require('@rollup/plugin-replace')
function externalValidator (patterns) {
return id => patterns.some(pattern => id.startsWith(pattern))
}
module.exports = {
input: 'src/index.js',
2020-02-12 13:44:53 +08:00
output: [
{
format: 'cjs',
2020-10-31 18:02:14 +08:00
dir: 'lib',
2020-11-12 19:34:20 +08:00
exports: 'named',
2020-10-31 18:02:14 +08:00
preserveModules: true
2020-02-12 13:44:53 +08:00
},
{
format: 'esm',
2020-10-31 18:02:14 +08:00
dir: 'es',
preserveModules: true
2020-02-12 13:44:53 +08:00
}
],
plugins: [
2020-11-03 14:05:05 +08:00
replace({
__DEV__: 'process.env.NODE_ENV !== "production"'
}),
2020-10-31 18:02:14 +08:00
nodeResolve({
2020-02-12 13:44:53 +08:00
extensions: ['.js', '.json', '.vue']
}),
cssRenderPlugin(),
2020-11-02 15:40:23 +08:00
vuePlugin(),
terser({
mangle: false,
output: {
beautify: true,
indent_level: 2
}
})
],
external: externalValidator([
2020-02-12 13:44:53 +08:00
'async-validator',
2020-05-16 22:07:58 +08:00
'date-fns',
2020-02-12 13:44:53 +08:00
'lodash-es',
2020-10-31 18:02:14 +08:00
'vue',
'treemate',
2020-10-28 01:38:23 +08:00
'css-render',
2020-10-09 18:56:22 +08:00
'@css-render/plugin-bem',
2020-10-28 01:38:23 +08:00
'vueuc',
2020-11-03 19:04:08 +08:00
'vooks',
'evtd'
])
}