-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathrollup.npm.config.mjs
39 lines (34 loc) · 1.18 KB
/
rollup.npm.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
// @ts-check
import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import replace from '@rollup/plugin-replace';
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
const packageJson = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf-8'));
if (!packageJson.version) {
throw new Error('invariant: package version not found');
}
const packageVersion = packageJson.version;
export default makeNPMConfigVariants(
makeBaseNPMConfig({
packageSpecificConfig: {
output: {
// set exports to 'named' or 'auto' so that rollup doesn't warn
exports: 'named',
// set preserveModules to true because we don't want to bundle everything into one file.
preserveModules:
process.env.SENTRY_BUILD_PRESERVE_MODULES === undefined
? true
: Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES),
},
plugins: [
replace({
preventAssignment: true,
values: {
__SENTRY_SDK_VERSION__: JSON.stringify(packageVersion),
},
}),
],
},
}),
);