-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
47 lines (42 loc) · 1.21 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// @ts-check
const path = require('path')
const { defineConfig } = require('vite')
module.exports = defineConfig(({command, mode})=>{
/** @type {import('vite').UserConfig} */
const config = {
build: {
emptyOutDir: false,
lib: {
entry: path.resolve(__dirname, 'src/main.ts'),
name: 'ludic',
fileName: (format) => mode === 'development' ? `ludic.dev.${format}.js` : `ludic.${format}.js`,
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
// external: ['vue'],
// output: {
// // Provide global variables to use in the UMD build
// // for externalized deps
// globals: {
// vue: 'Vue'
// }
// }
},
},
define: {
__vite_process_env_NODE_ENV: JSON.stringify('process.env.NODE_ENV'),
},
resolve: {
alias: {},
},
}
if(mode === 'development'){
console.log('dev mode')
// @ts-ignore
config.define['import.meta.hot'] = 'import.meta.hot'
// @ts-ignore
config.resolve.alias['@ludic/ein'] = path.resolve(__dirname, 'node_modules/@ludic/ein/dist/ein.dev.es.js')
}
return config
})