-
Notifications
You must be signed in to change notification settings - Fork 19
/
rollup.config.ts
72 lines (63 loc) · 1.89 KB
/
rollup.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 sourceMaps from 'rollup-plugin-sourcemaps';
import typescript from 'rollup-plugin-typescript2';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import globals from 'rollup-plugin-node-globals';
import builtins from 'rollup-plugin-node-builtins';
import json from 'rollup-plugin-json';
import strip from '@rollup/plugin-strip';
const pkg = require('./package.json');
const libraryName = 'ens-validation';
/**
* Include all of the dependencies here to exclude all node modules from the build
* Make sure to also include node libraries you're using e.g. 'crypto'
*/
// const external = [...Object.keys(pkg.dependencies || {})];
const external = ['lodash', 'utf8', 'url'];
/**
* Include all of the dependencies again here to squash rollup warnings
*/
const outputGlobals = {};
// tslint:disable-next-line
export default {
input: `src/index.ts`,
output: [
{
file: pkg.main,
name: libraryName,
format: 'umd',
globals: outputGlobals,
sourcemap: true,
},
{ file: pkg.module, format: 'es', globals: outputGlobals, sourcemap: true },
],
// exclude all node modules
external,
watch: {
include: 'src/**',
},
plugins: [
builtins(),
nodeResolve({ jsnext: true, main: true, browser: true }),
commonjs({
exclude: ['node_modules/rollup-plugin-node-globals/**'],
namedExports: {
'./node_modules/punycode/punycode.js': ['toUnicode' ],
'./node_modules/rollup-plugin-node-builtins/src/es6/url.js': [ 'Url' ],
'./node_modules/xregexp/lib/index.js': [ 'OuterXRegExp' ],
},
}),
globals(),
json(),
// Compile TypeScript files
typescript({
useTsconfigDeclarationDir: true,
tsconfig: './tsconfig-build.json',
}),
// Resolve source maps to the original source
sourceMaps(),
strip({
include: ['**/*.ts']
})
],
};