Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(replay): Stop preserving modules #6817

Merged
merged 2 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions packages/replay/rollup.npm.config.js
Original file line number Diff line number Diff line change
@@ -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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is the default value for rollup configs; we need to set it explicitly here because makeBaseNPMConfig sets it to true.

},
},
}),
Expand Down
6 changes: 0 additions & 6 deletions rollup/npmHelpers.js
Original file line number Diff line number Diff line change
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,
Copy link
Member Author

@Lms24 Lms24 Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was stale as we now don't even use isDebugBuild anymore in the SDKs. Hence we can permit the default mode of tree shaking again.

};

return deepMerge(defaultBaseConfig, packageSpecificConfig, {
Expand Down