-
Notifications
You must be signed in to change notification settings - Fork 6
/
rollup.cliUtils.config.ts
41 lines (39 loc) · 1.19 KB
/
rollup.cliUtils.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
import { defineConfig } from 'rollup';
import swc from '@rollup/plugin-swc';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import { globalDefines } from './globalDefines.mts';
const replaceConfig = Object.entries(globalDefines).reduce<Record<string, string>>(
(memo, [key, value]) => ({
...memo,
[`import.meta.env.${key}`]: value,
}),
{},
);
export default defineConfig({
plugins: [
replace({ ...replaceConfig, preventAssignment: true }),
commonjs(),
nodeResolve({
extensions: ['.ts', '.tsx', '.js', '.jsx'],
resolveOnly(module) {
// commonjs plugin isn't liking the rollbar package, which we don't need in the CLI utils anyway
return module !== 'rollbar';
},
}),
swc(),
],
input: {
diffTranslations: './script/diffTranslations.ts',
mergeTranslations: './script/mergeTranslations.ts',
renderFormResponseChangeGroup: './script/renderFormResponseChangeGroup.tsx',
},
output: {
format: 'cjs',
entryFileNames: '[name].cjs',
dir: './bin',
interop: 'auto',
chunkFileNames: 'chunks/[name]-[hash].js',
},
});