naive-ui/vite.config.js
2021-02-17 23:31:56 +08:00

46 lines
1014 B
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: {
exclude: ['__INDEX__']
},
build: {
outDir: 'site',
rollupOptions: {
plugins: [
babel({
babelHelpers: 'bundled'
})
]
}
},
esbuild: {
jsxFactory: 'h',
jsxFragment: 'Fragment'
}
}