-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.js
65 lines (58 loc) · 1.4 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
import typescript from '@rollup/plugin-typescript'
import jsonPlugin from '@rollup/plugin-json'
import { dts } from 'rollup-plugin-dts'
import licensePlugin from 'rollup-plugin-license'
import { join } from 'path'
import replace from '@rollup/plugin-replace'
import nodeResolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
const packageJson = require('./package.json')
const inputFile = 'src/index.ts'
const outputDirectory = 'dist'
const artifactName = 'fingerprintjs-pro-cloudflare-worker'
const commonBanner = licensePlugin({
banner: {
content: {
file: join(__dirname, 'assets', 'license_banner.txt'),
},
},
})
const commonInput = {
input: inputFile,
plugins: [
replace({
__current_worker_version__: packageJson.version,
preventAssignment: true,
}),
jsonPlugin(),
typescript(),
commonBanner,
nodeResolve({ preferBuiltins: false }),
commonjs(),
],
}
const commonOutput = {
name: 'fingerprintjs-pro-cloudflare-worker',
exports: 'named',
}
export default [
{
...commonInput,
output: [
{
...commonOutput,
file: `${outputDirectory}/${artifactName}.esm.js`,
format: 'es',
},
],
},
// TypeScript definition
{
...commonInput,
plugins: [dts(), commonBanner],
output: {
file: `${outputDirectory}/${artifactName}.d.ts`,
format: 'es',
},
},
]