-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
110 lines (107 loc) · 3.03 KB
/
rollup.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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import resolve from '@rollup/plugin-node-resolve';
import commonjs from "@rollup/plugin-commonjs";
import babel from '@rollup/plugin-babel'
import ts from 'rollup-plugin-typescript2'
import dts from "rollup-plugin-dts";
import replace from '@rollup/plugin-replace'
import path from 'path';
import json from "@rollup/plugin-json";
import copy from 'rollup-plugin-copy';
import nodePolyfills from 'rollup-plugin-polyfill-node'
import { terser } from "rollup-plugin-terser"
export default [
{
input: 'src/packages/index.ts',
output: [
{
preserveModules: true,
dir: 'dist/esm',
format: 'es',
},
],
plugins: [
resolve({
extensions: ['.js', '.ts', '.jsx', '.tsx'],
modulesOnly: true,
preferBuiltins: false
}),
ts({
tsconfig: path.resolve(__dirname, 'tsconfig.json')
}),
copy({
targets: [
{
src: 'src/packages/README.md',
dest: 'dist/esm'
}
]
}),
json(),
commonjs(),
babel({
babelrc: false,
babelHelpers: 'bundled' ,
// plugins: [
// '@babel/transform-runtime'
// ],
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss'],
presets: ['@babel/preset-env', '@babel/preset-react']
}),
// replace({
// 'process.env.NODE_ENV': JSON.stringify( 'production' ),
// preventAssignment: true
// })
],
external: [
'react',
'react-dom',
'ethers',
'react/jsx-runtime',
],
},
{
input: 'src/packages/index.ts',
output: [{ file: "dist/esm/index.d.ts", format: "es" }],
plugins: [dts()],
},
{
input: 'src/packages/init.tsx',
output: [
{
file: 'dist/umd/bundle.js',
format: 'umd',
name: "Web3pay",
inlineDynamicImports: true,
},
],
plugins: [
resolve({
extensions: ['.js', '.ts', '.jsx', '.tsx'],
modulesOnly: false,
preferBuiltins: false
}),
ts({
tsconfig: path.resolve(__dirname, 'tsconfig.json')
}),
json(),
commonjs(),
babel({
babelrc: false,
babelHelpers: 'runtime' ,
plugins: [
'@babel/transform-runtime'
],
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss'],
presets: ['@babel/preset-env', '@babel/preset-react']
}),
replace({
'process.env.NODE_ENV': JSON.stringify( 'production' ),
preventAssignment: true
}),
nodePolyfills(),
terser()
],
},
];