-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
68 lines (62 loc) · 1.56 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
import typescript from '@rollup/plugin-typescript'
import jsonPlugin from '@rollup/plugin-json'
import licensePlugin from 'rollup-plugin-license'
import dtsPlugin from 'rollup-plugin-dts'
import replace from '@rollup/plugin-replace'
import { join } from 'path'
import nodeResolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
const dotenv = require('dotenv')
dotenv.config()
const packageJson = require('./package.json')
const inputFile = 'src/app.ts'
const outputDirectory = 'dist'
const artifactName = 'fingerprintjs-pro-cloudfront-lambda-function'
const commonBanner = licensePlugin({
banner: {
content: {
file: join(__dirname, 'assets', 'license_banner.txt'),
},
},
})
const commonInput = {
input: inputFile,
external: ['aws-sdk', 'https'],
plugins: [
jsonPlugin(),
typescript(),
nodeResolve({ preferBuiltins: false }),
commonjs(),
replace({
__FPCDN__: process.env.FPCDN,
__INGRESS_API__: process.env.INGRESS_API,
__lambda_func_version__: packageJson.version,
preventAssignment: true,
}),
commonBanner,
],
}
const commonOutput = {
name: 'fingerprintjs-pro-cloudfront-lambda-function',
exports: 'named',
}
export default [
{
...commonInput,
output: [
{
...commonOutput,
file: `${outputDirectory}/${artifactName}.js`,
format: 'cjs',
},
],
},
{
...commonInput,
plugins: [dtsPlugin(), commonBanner],
output: {
file: `${outputDirectory}/${artifactName}.d.ts`,
format: 'es',
},
},
]