-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrollup.config.js
More file actions
46 lines (44 loc) · 1.19 KB
/
rollup.config.js
File metadata and controls
46 lines (44 loc) · 1.19 KB
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
import fs from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
const configPath = join(
dirname(fileURLToPath(import.meta.url)),
'./package.json',
);
const pkg = JSON.parse(fs.readFileSync(configPath, 'utf8'));
export default {
input: [
'src/index.ts',
'src/scrapers.ts',
'src/search.ts',
'src/datasets.ts',
],
external: [...Object.keys(pkg.dependencies), /^node:/],
output: [
{
dir: 'dist/esm',
format: 'esm',
entryFileNames: '[name].mjs',
preserveModules: true,
preserveModulesRoot: 'src',
},
{
dir: 'dist/cjs',
format: 'cjs',
entryFileNames: '[name].cjs',
preserveModules: true,
preserveModulesRoot: 'src',
},
],
plugins: [
typescript({
tsconfig: 'tsconfig.json',
}),
replace({
preventAssignment: true,
'process.env.BRD_PACKAGE_VERSION': JSON.stringify(pkg.version),
}),
],
};