Skip to content

Commit fdf9ff8

Browse files
authored
build(replay): Stop preserving modules (#6817)
Stop preserving JS modules when transpiling the Replay package. With this change, everything is bundled into one `index.js` file (similarly to CDN bundles) which avoids weird bundler/plugin errors that emerge because of our file structure inside our NPM package.
1 parent 530b7a0 commit fdf9ff8

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

packages/replay/rollup.npm.config.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import path from 'path';
2-
31
import replace from '@rollup/plugin-replace';
42

53
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index';
@@ -23,12 +21,7 @@ export default makeNPMConfigVariants(
2321
// set exports to 'named' or 'auto' so that rollup doesn't warn about
2422
// the default export in `worker/worker.js`
2523
exports: 'named',
26-
27-
// As we are inlining the rrweb dependency here, we need to ensure the nested folders are correct
28-
// Without this config, you get:
29-
// * build/npm/esm/node_modules/rrweb/...
30-
// * build/npm/esm/packages/replay/...
31-
preserveModulesRoot: path.join(process.cwd(), 'src'),
24+
preserveModules: false,
3225
},
3326
},
3427
}),

rollup/npmHelpers.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ export function makeBaseNPMConfig(options = {}) {
9595
...Object.keys(packageDotJSON.dependencies || {}),
9696
...Object.keys(packageDotJSON.peerDependencies || {}),
9797
],
98-
99-
// TODO `'smallest'` will get rid of `isDebugBuild()` by evaluating it and inlining the result and then treeshaking
100-
// from there. The current setting (false) prevents this, in case we want to leave it there for users to use in
101-
// their own bundling. That said, we don't yet know for sure that that works, so come back to this.
102-
// treeshake: 'smallest',
103-
treeshake: false,
10498
};
10599

106100
return deepMerge(defaultBaseConfig, packageSpecificConfig, {

0 commit comments

Comments
 (0)