Skip to content

Commit

Permalink
build(replay): Stop preserving modules (#6817)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lms24 committed Jan 18, 2023
1 parent 530b7a0 commit fdf9ff8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
9 changes: 1 addition & 8 deletions packages/replay/rollup.npm.config.js
@@ -1,5 +1,3 @@
import path from 'path';

import replace from '@rollup/plugin-replace';

import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index';
Expand All @@ -23,12 +21,7 @@ export default makeNPMConfigVariants(
// set exports to 'named' or 'auto' so that rollup doesn't warn about
// the default export in `worker/worker.js`
exports: 'named',

// As we are inlining the rrweb dependency here, we need to ensure the nested folders are correct
// Without this config, you get:
// * build/npm/esm/node_modules/rrweb/...
// * build/npm/esm/packages/replay/...
preserveModulesRoot: path.join(process.cwd(), 'src'),
preserveModules: false,
},
},
}),
Expand Down
6 changes: 0 additions & 6 deletions rollup/npmHelpers.js
Expand Up @@ -95,12 +95,6 @@ export function makeBaseNPMConfig(options = {}) {
...Object.keys(packageDotJSON.dependencies || {}),
...Object.keys(packageDotJSON.peerDependencies || {}),
],

// TODO `'smallest'` will get rid of `isDebugBuild()` by evaluating it and inlining the result and then treeshaking
// from there. The current setting (false) prevents this, in case we want to leave it there for users to use in
// their own bundling. That said, we don't yet know for sure that that works, so come back to this.
// treeshake: 'smallest',
treeshake: false,
};

return deepMerge(defaultBaseConfig, packageSpecificConfig, {
Expand Down

0 comments on commit fdf9ff8

Please sign in to comment.