forked from vankasteelj/trakt.tv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
43 lines (40 loc) · 1.03 KB
/
rollup.config.mjs
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
import babel from '@rollup/plugin-babel';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import { readFileSync } from 'node:fs';
// Use import.meta.url to make the path relative to the current source
// file instead of process.cwd(). For more information:
// https://nodejs.org/docs/latest-v16.x/api/esm.html#importmetaurl
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url)));
export default {
input: 'src/trakt.js',
output: {
file: pkg.main,
format: 'cjs',
exports: 'default',
interop: 'auto',
},
external: [
'ky',
'randombytes',
],
plugins: [
replace({
preventAssignment: true,
values: {
'__DEFAULT_USER_AGENT__': JSON.stringify(`${pkg.name}/${pkg.version} (${pkg.repository.url})`)
}
}),
json(),
babel({
babelrc: false,
babelHelpers: 'bundled',
presets: [
['@babel/preset-env', {
modules: 'auto'
}]
],
exclude: 'node_modules/**'
}),
]
};