2020-10-31 18:02:14 +08:00
|
|
|
const vuePlugin = require('rollup-plugin-vue')
|
2020-11-12 13:30:04 +08:00
|
|
|
const cssRenderPlugin = require('./build/rollup-plugin-css-render')
|
2020-10-31 18:02:14 +08:00
|
|
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
2019-12-30 13:15:14 +08:00
|
|
|
const { terser } = require('rollup-plugin-terser')
|
2020-11-03 14:05:05 +08:00
|
|
|
const replace = require('@rollup/plugin-replace')
|
2019-12-30 13:15:14 +08:00
|
|
|
|
2020-11-05 15:31:40 +08:00
|
|
|
function externalValidator (patterns) {
|
|
|
|
return id => patterns.some(pattern => id.startsWith(pattern))
|
|
|
|
}
|
|
|
|
|
2019-12-30 13:15:14 +08:00
|
|
|
module.exports = {
|
2020-02-12 16:21:42 +08:00
|
|
|
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
|
|
|
}
|
|
|
|
],
|
2019-12-30 13:15:14 +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']
|
|
|
|
}),
|
2020-11-12 13:30:04 +08:00
|
|
|
cssRenderPlugin(),
|
2020-11-02 15:40:23 +08:00
|
|
|
vuePlugin(),
|
2019-12-30 13:15:14 +08:00
|
|
|
terser({
|
|
|
|
mangle: false,
|
|
|
|
output: {
|
|
|
|
beautify: true,
|
|
|
|
indent_level: 2
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2020-11-05 15:31:40 +08:00
|
|
|
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',
|
2020-11-05 15:31:40 +08:00
|
|
|
'evtd'
|
|
|
|
])
|
2019-12-30 13:15:14 +08:00
|
|
|
}
|