forked from ping-pub/widget
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
62 lines (60 loc) · 1.76 KB
/
vite.config.ts
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// @ts-nocheck
import { resolve } from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import inject from '@rollup/plugin-inject';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), cssInjectedByJsPlugin()],
resolve: {
preserveSymlinks: true,
alias: {
path: 'path-browserify',
stream: 'stream-browserify',
crypto: 'crypto-browserify',
assert: 'assert-browserify',
},
},
optimizeDeps: {
force: true,
esbuildOptions: {
target: ['es2020'],
define: {
global: 'globalThis',
},
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
],
},
},
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'lib/main.ts'),
name: 'ping-widget',
// the proper extensions will be added
fileName: 'ping-widget',
},
commonjsOptions: {
transformMixedEsModules: true,
},
rollupOptions: {
output: {
manualChunks: undefined,
},
plugins: [
nodePolyfills({
process: true,
buffer: true,
}),
inject({ Buffer: ['buffer', 'Buffer'] }),
],
},
},
});