2019-12-30 13:15:14 +08:00
|
|
|
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')
|
2019-12-30 13:15:14 +08:00
|
|
|
|
2020-02-12 13:44:53 +08:00
|
|
|
function externalValidator (ids) {
|
|
|
|
return id => ids.some(identifier => id.startsWith(identifier))
|
|
|
|
}
|
|
|
|
|
2019-12-30 13:15:14 +08:00
|
|
|
module.exports = {
|
2020-01-13 14:26:14 +08:00
|
|
|
preserveModules: true,
|
2020-02-12 16:21:42 +08:00
|
|
|
input: 'src/index.js',
|
2020-02-12 13:44:53 +08:00
|
|
|
output: [
|
|
|
|
{
|
|
|
|
format: 'cjs',
|
|
|
|
dir: 'lib'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
format: 'esm',
|
|
|
|
dir: 'es'
|
|
|
|
}
|
|
|
|
],
|
2019-12-30 13:15:14 +08:00
|
|
|
plugins: [
|
2020-02-12 13:44:53 +08:00
|
|
|
resolve({
|
|
|
|
extensions: ['.js', '.json', '.vue']
|
|
|
|
}),
|
2019-12-30 13:15:14 +08:00
|
|
|
vue(),
|
2020-01-13 14:26:14 +08:00
|
|
|
naiveSCSSVariable(),
|
2019-12-30 13:15:14 +08:00
|
|
|
strip(),
|
|
|
|
terser({
|
|
|
|
mangle: false,
|
|
|
|
output: {
|
|
|
|
beautify: true,
|
|
|
|
indent_level: 2
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2020-02-12 13:44:53 +08:00
|
|
|
external: externalValidator([
|
2019-12-30 13:15:14 +08:00
|
|
|
'vue-runtime-helpers',
|
2020-02-12 13:44:53 +08:00
|
|
|
'date-fns',
|
|
|
|
'async-validator',
|
|
|
|
'vue-virtual-scroller',
|
|
|
|
'lodash-es',
|
2019-12-30 13:15:14 +08:00
|
|
|
'resize-observer-polyfill'
|
2020-02-12 13:44:53 +08:00
|
|
|
])
|
2019-12-30 13:15:14 +08:00
|
|
|
}
|