mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
61 lines
1.3 KiB
JavaScript
61 lines
1.3 KiB
JavaScript
const cssRenderPlugin = require('./build/rollup-plugin-css-render')
|
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
|
const { terser } = require('rollup-plugin-terser')
|
|
const replace = require('@rollup/plugin-replace')
|
|
const { babel } = require('@rollup/plugin-babel')
|
|
|
|
function externalValidator (patterns) {
|
|
return (id) => patterns.some((pattern) => id.startsWith(pattern))
|
|
}
|
|
|
|
// do not use babel when build library, use it when only build the site
|
|
module.exports = {
|
|
input: 'src-mirror/index.js',
|
|
output: [
|
|
{
|
|
format: 'cjs',
|
|
dir: 'lib',
|
|
exports: 'named',
|
|
preserveModules: true
|
|
},
|
|
{
|
|
format: 'esm',
|
|
dir: 'es',
|
|
preserveModules: true
|
|
}
|
|
],
|
|
plugins: [
|
|
replace({
|
|
__DEV__: 'process.env.NODE_ENV !== "production"'
|
|
}),
|
|
nodeResolve({
|
|
extensions: ['.js', '.json']
|
|
}),
|
|
cssRenderPlugin(),
|
|
babel({
|
|
babelHelpers: 'bundled'
|
|
}),
|
|
terser({
|
|
mangle: false,
|
|
output: {
|
|
beautify: true,
|
|
indent_level: 2
|
|
}
|
|
})
|
|
],
|
|
external: externalValidator([
|
|
'async-validator',
|
|
'date-fns',
|
|
'lodash-es',
|
|
'vue',
|
|
'treemate',
|
|
'css-render',
|
|
'@css-render/plugin-bem',
|
|
'vueuc',
|
|
'vooks',
|
|
'evtd',
|
|
'vdirs',
|
|
'seemly'
|
|
])
|
|
}
|