2019-12-30 13:15:14 +08:00
|
|
|
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')
|
2019-12-30 13:15:14 +08:00
|
|
|
|
2020-02-14 16:49:35 +08:00
|
|
|
function externalValidator (patterns) {
|
|
|
|
return id => patterns.some(pattern => id.startsWith(pattern))
|
2020-02-12 13:44:53 +08:00
|
|
|
}
|
|
|
|
|
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']
|
|
|
|
}),
|
2020-02-20 23:52:49 +08:00
|
|
|
vue({
|
|
|
|
template: {
|
|
|
|
compilerOptions: {
|
|
|
|
preserveWhitespace: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
2020-01-13 14:26:14 +08:00
|
|
|
naiveSCSSVariable(),
|
2019-12-30 13:15:14 +08:00
|
|
|
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
|
|
|
])
|
2019-12-30 13:15:14 +08:00
|
|
|
}
|