naive-ui/rollup.config.js

48 lines
977 B
JavaScript
Raw Normal View History

const vue = require('rollup-plugin-vue')
const resolve = require('@rollup/plugin-node-resolve')
const strip = require('@rollup/plugin-strip')
const { terser } = require('rollup-plugin-terser')
2020-02-13 22:22:04 +08:00
const naiveSCSSVariable = require('./build/naiveSCSSVarPlugin')
2020-02-17 09:55:20 +08:00
function externalValidator (patterns) {
return id => patterns.some(pattern => id.startsWith(pattern))
2020-02-12 13:44:53 +08:00
}
module.exports = {
preserveModules: true,
input: 'src/index.js',
2020-02-12 13:44:53 +08:00
output: [
{
format: 'cjs',
dir: 'lib'
},
{
format: 'esm',
dir: 'es'
}
],
plugins: [
2020-02-12 13:44:53 +08:00
resolve({
extensions: ['.js', '.json', '.vue']
}),
vue(),
naiveSCSSVariable(),
strip(),
terser({
mangle: false,
output: {
beautify: true,
indent_level: 2
}
})
],
2020-02-12 13:44:53 +08:00
external: externalValidator([
'vue-runtime-helpers',
2020-02-12 13:44:53 +08:00
'date-fns',
'async-validator',
'vue-virtual-scroller',
'lodash-es',
'resize-observer-polyfill'
2020-02-12 13:44:53 +08:00
])
}