forked from pangolindex/components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
64 lines (61 loc) · 1.6 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
import typescript from 'rollup-plugin-typescript2';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import cleaner from 'rollup-plugin-cleaner';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import includePaths from 'rollup-plugin-includepaths';
// import packageJson from './package.json';
import url from '@rollup/plugin-url';
import css from 'rollup-plugin-import-css';
import path from 'path';
import externals from 'rollup-plugin-node-externals';
import { terser } from 'rollup-plugin-terser';
let plugins = [
externals(),
peerDepsExternal(),
includePaths({
paths: ['./'],
extensions: ['.tsx', '.ts', '.js'],
}),
resolve(),
url({
include: ['**/*.svg', '**/*.png', '**/*.jp(e)?g', '**/*.gif', '**/*.webp'],
emitFiles: true,
fileName: '[dirname][hash][extname]',
sourceDir: path.join(__dirname, 'src'),
}),
css(),
commonjs(),
json(),
typescript({
check: false,
exclude: ['**/*.stories.tsx', '**/*.test.tsx'],
}),
];
if (process.env.ENV === 'production') {
plugins.push(
cleaner({
targets: ['./lib'],
}),
terser(),
);
}
export default {
// we are ignoring gifwrap here because we have added @gelatonetwork/limit-orders-react to dependancies. and it is throwing error "gifcodec is not constructor"
external: ['gifwrap'],
input: 'src/index.tsx',
output: [
{
dir: 'lib/cjs',
format: 'cjs',
sourcemap: true,
},
{
dir: 'lib/esm',
format: 'esm',
sourcemap: true,
},
],
plugins: plugins,
};