|
1 | 1 | import replace from '@rollup/plugin-replace'; |
2 | | -import typescript from '@rollup/plugin-typescript'; |
3 | | -import { defineConfig } from 'rollup'; |
| 2 | + |
| 3 | +import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index'; |
4 | 4 |
|
5 | 5 | import pkg from './package.json'; |
6 | 6 |
|
7 | | -const config = defineConfig({ |
8 | | - input: './src/index.ts', |
9 | | - output: [ |
10 | | - { |
11 | | - file: pkg.main, |
12 | | - format: 'cjs', |
13 | | - sourcemap: true, |
14 | | - }, |
15 | | - { |
16 | | - file: pkg.module, |
17 | | - format: 'esm', |
18 | | - }, |
19 | | - ], |
20 | | - external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})], |
21 | | - plugins: [ |
22 | | - typescript({ |
23 | | - tsconfig: './tsconfig.json', |
24 | | - }), |
25 | | - replace({ |
26 | | - // __SENTRY_DEBUG__ should be save to replace in any case, so no checks for assignments necessary |
27 | | - preventAssignment: false, |
28 | | - values: { |
29 | | - __SENTRY_REPLAY_VERSION__: JSON.stringify(pkg.version), |
30 | | - // @ts-ignore not gonna deal with types here |
31 | | - __SENTRY_DEBUG__: true, |
32 | | - // @ts-ignore not gonna deal with types here |
33 | | - __DEBUG_BUILD__: true, |
| 7 | +export default makeNPMConfigVariants( |
| 8 | + makeBaseNPMConfig({ |
| 9 | + hasBundles: true, |
| 10 | + packageSpecificConfig: { |
| 11 | + external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})], |
| 12 | + plugins: [ |
| 13 | + replace({ |
| 14 | + // __SENTRY_DEBUG__ should be save to replace in any case, so no checks for assignments necessary |
| 15 | + preventAssignment: false, |
| 16 | + values: { |
| 17 | + __SENTRY_REPLAY_VERSION__: JSON.stringify(pkg.version), |
| 18 | + // @ts-ignore not gonna deal with types here |
| 19 | + __SENTRY_DEBUG__: true, |
| 20 | + // @ts-ignore not gonna deal with types here |
| 21 | + __DEBUG_BUILD__: true, |
| 22 | + }, |
| 23 | + }), |
| 24 | + ], |
| 25 | + output: { |
| 26 | + // set exports to 'named' or 'auto' so that rollup doesn't warn about |
| 27 | + // the default export in `worker/worker.js` |
| 28 | + exports: 'named', |
34 | 29 | }, |
35 | | - }), |
36 | | - ], |
37 | | -}); |
38 | | - |
39 | | -export default config; |
| 30 | + }, |
| 31 | + }), |
| 32 | +); |
0 commit comments