-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
64 lines (63 loc) · 1.54 KB
/
rollup.config.js
File metadata and controls
64 lines (63 loc) · 1.54 KB
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
import alias from '@rollup/plugin-alias'
import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import globals from './rollup.globals.js'
import json from '@rollup/plugin-json'
import nodePolyfills from 'rollup-plugin-polyfill-node'
import pkg from './package.json'
import replace from '@rollup/plugin-replace'
import { nodeResolve } from '@rollup/plugin-node-resolve'
export default {
input: 'src/index.js',
output: [
{
format: 'es',
globals: globals,
file: 'dist/esm/index.js',
},
{
format: 'umd',
name: pkg.moduleName,
globals: globals,
file: 'dist/umd/index.js',
},
],
external: [
],
treeshake: {
moduleSideEffects: false,
},
plugins: [
alias({
entries: [
{ find: 'react', replacement: './empty-module.js' },
],
}),
nodeResolve({
browser: true,
dedupe: ['bn.js', 'buffer'],
extensions: ['.js','.ts'],
preferBuiltins: false
}),
commonjs({
transformMixedEsModules: true
}),
json(),
nodePolyfills(),
babel({
babelHelpers: 'bundled',
presets: ["@babel/preset-env"],
plugins: ["transform-vite-meta-env"]
}),
replace({
preventAssignment: true,
'global.Promise': '_global$1.Promise',
'process.env.NODE_ENV': JSON.stringify('product'),
'process.env.BROWSER': JSON.stringify('true'),
'process.env.npm_package_version': JSON.stringify(
process.env.npm_package_version,
),
'process.env': '{}',
}),
]
}