-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
72 lines (68 loc) · 1.65 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
63
64
65
66
67
68
69
70
71
72
import tailwindcss from 'tailwindcss';
import { defineConfig } from 'vite'
import { resolve } from 'node:path'
import react from '@vitejs/plugin-react-swc'
import * as packageJson from './package.json'
import dts from "vite-plugin-dts";
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
import replace from '@rollup/plugin-replace';
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
replace({
"process.env.NODE_ENV": JSON.stringify("development")
}),
commonjs({
include: /node_modules/,
requireReturnsDefault: 'auto',
}),
babel({
babelrc: true,
exclude: 'node_modules/**'
}),
react(), dts({
rollupTypes: true,
})],
optimizeDeps: {
disabled: false,
esbuildOptions: {
define: {
global: 'globalThis',
},
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: false
}),
]
},
include: [
'.js',
'.mjs',
],
},
resolve: {
alias: {
'process/browser': resolve('process/browser.js'),
'path': 'path-browserify',
"querystring": "querystring-es3"
},
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
},
build: {
lib: {
entry: resolve('src', 'index.ts'),
name: 'deposit-widget',
formats: ['es'],
fileName: (format) => `index.js`,
},
rollupOptions: {
external: [...Object.keys(packageJson.dependencies)],
},
commonjsOptions: {
ignore: ['@reduxjs/toolkit'], // Ignore the problematic module
include : []
},
},
})