forked from ensdomains/ens-validation
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.ts
80 lines (72 loc) · 2.13 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
73
74
75
76
77
78
79
80
import sourceMaps from 'rollup-plugin-sourcemaps';
import typescript from '@rollup/plugin-typescript';
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';
import dts from 'rollup-plugin-dts';
const pkg = require('./package.json');
const libraryName = 'ans-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({ mainFields: ['module', 'jsnext:main', 'main', 'browser'] }),
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',
//verbosity: 3,
}),
// Resolve source maps to the original source
sourceMaps(),
strip({
include: ['**/*.ts']
})
],
}
/*, {
// path to your declaration files root
input: './dist/types/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts.default()],
}*/
];