naive-ui/rollup.config.js

54 lines
1.0 KiB
JavaScript
Raw Normal View History

const vue = require('rollup-plugin-vue')
const resolve = require('@rollup/plugin-node-resolve')
const { terser } = require('rollup-plugin-terser')
2020-02-13 22:22:04 +08:00
const naiveSCSSVariable = require('./build/naiveSCSSVarPlugin')
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({
template: {
compilerOptions: {
whitespace: 'condense'
}
}
}),
naiveSCSSVariable(),
terser({
mangle: false,
output: {
beautify: true,
indent_level: 2
}
})
],
2020-02-12 13:44:53 +08:00
external: externalValidator([
'async-validator',
2020-05-16 22:07:58 +08:00
'css-render',
'date-fns',
2020-02-12 13:44:53 +08:00
'lodash-es',
2020-05-16 20:48:52 +08:00
'resize-observer-polyfill',
2020-05-16 22:07:58 +08:00
'vue-runtime-helpers',
'vue-virtual-scroller',
2020-05-16 20:48:52 +08:00
'@css-render/plugin-bem'
2020-02-12 13:44:53 +08:00
])
}