mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-03 04:21:34 +08:00
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
const path = require('path')
|
|
const { babel } = require('@rollup/plugin-babel')
|
|
const createDemoPlugin = require('./build/vite-plugin-demo')
|
|
|
|
/**
|
|
* @type {import('vite').UserConfig}
|
|
*/
|
|
module.exports = {
|
|
root: __dirname,
|
|
plugins: createDemoPlugin(),
|
|
resolve: {
|
|
// In production site build, we want to import naive-ui from node_modules
|
|
alias:
|
|
process.env.NODE_ENV !== 'production'
|
|
? [
|
|
{
|
|
find: 'naive-ui',
|
|
replacement: path.resolve(__dirname, './src')
|
|
}
|
|
]
|
|
: undefined
|
|
},
|
|
define: {
|
|
'process.env.NODE_ENV': `'${process.env.NODE_ENV}'`,
|
|
'process.env.TUSIMPLE': !!process.env.TUSIMPLE,
|
|
__DEV__: process.env.NODE_ENV !== 'production'
|
|
},
|
|
optimizeDeps: {
|
|
include: [
|
|
'@css-render/plugin-bem',
|
|
'async-validator',
|
|
'css-render',
|
|
'date-fns',
|
|
'evtd',
|
|
'highlight.js',
|
|
'lodash-es',
|
|
'seemly',
|
|
'treemate',
|
|
'vdirs',
|
|
'vooks',
|
|
'vue',
|
|
'vue-router',
|
|
'vueuc'
|
|
],
|
|
exclude: ['__INDEX__']
|
|
},
|
|
build: {
|
|
outDir: 'site',
|
|
rollupOptions: {
|
|
plugins: [
|
|
babel({
|
|
babelHelpers: 'bundled'
|
|
})
|
|
]
|
|
}
|
|
},
|
|
esbuild: {
|
|
jsxFactory: 'h',
|
|
jsxFragment: 'Fragment'
|
|
}
|
|
}
|