-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.js
44 lines (42 loc) · 1.13 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
function wrapIIFE() {
return {
name: 'wrap-iife',
generateBundle(options, bundle) {
const fileName = 'nous-chat.js'
const file = bundle[fileName]
if (file) {
file.code = `(function(global){
var process = { env: { NODE_ENV: 'production' } };
${file.code}
global.Nous = Nous;
})(typeof window !== 'undefined' ? window : this);`;
}
}
}
}
export default defineConfig({
plugins: [vue(), wrapIIFE()],
build: {
lib: {
entry: 'src/main.js',
name: 'Nous',
fileName: () => 'nous-chat.js',
formats: ['iife']
},
rollupOptions: {
external: [], // Empty array means no external dependencies
output: {
globals: {} // Empty object as we're not using any globals
}
},
cssCodeSplit: false,
},
define: {
'process.env.NODE_ENV': JSON.stringify('production')
},
server: {
open: './index.html'
}
})