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

fix(replay): Temporarily build Replay after other packages #6307

Merged
merged 2 commits into from
Nov 25, 2022

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Nov 25, 2022

This PR fixes a build error in Replay process by building it after all other packages (including their type declarations) were built. We have to do this temporarily because @rollup/plugin-typescript expects type declarations of the @sentry/* dependencies of the replay package. Because we're building types in parallel to transpiling JS, type declarations were not yet (reliably) built before replay's build:rollup commands was executed.

To unblock us, we for now build the package via build:extras so that it only runs after all other packages were fully built.

We should revert this change as soon as we use our transpilation process (sucrase) where we don't care about type declarations.

This might also fix the size-limit action on the master branch.

move replay build to `build:extras` to ensure that types of its deps build first
@Lms24 Lms24 requested a review from mydea November 25, 2022 14:30
@@ -9,7 +9,7 @@
"scripts": {
"bootstrap": "yarn && cd demo && yarn #TODO: change after migration",
"build": "yarn build:rollup",
Copy link
Member

Choose a reason for hiding this comment

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

hmm, will this work? As build calls build:rollup? 😅 I guess either change build to call build:extra, or remove it? (not sure)

Copy link
Member Author

@Lms24 Lms24 Nov 25, 2022

Choose a reason for hiding this comment

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

good point. I think for CI we'd be fine because build isn't called from the CI (the top-level yarn build executes build:rollup in every package). But I changed it anyway for consistency

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

Seems good for now! We can/should revisit later then 👍

@Lms24
Copy link
Member Author

Lms24 commented Nov 25, 2022

Definitely, this is only a temporary workaround. Should be resolved as soon as we use our transpiling process where we don't care about type declarations.

@Lms24 Lms24 enabled auto-merge (squash) November 25, 2022 14:40
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.53 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.42 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.21 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.77 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.94 KB (0%)
@sentry/browser - Webpack (minified) 65.25 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.96 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.96 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.41 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.83 KB (+0.01% 🔺)
@sentry/replay index.js 83.67 KB (-0.07% 🔽)
@sentry/replay - Webpack (gzipped + minified) 83.69 KB (-0.07% 🔽)
@sentry/replay - Webpack (minified) 272.17 KB (-0.06% 🔽)

@Lms24 Lms24 merged commit b49082e into master Nov 25, 2022
@Lms24 Lms24 deleted the lms-replay-fix-build-order branch November 25, 2022 14:50
Lms24 added a commit that referenced this pull request Nov 30, 2022
Update Replay's build config to use our monorepo's rollup config for building and transpiling the Replay integration. With this patch, we're introducing a breaking change because the tarball structure is going to change. However, this only breaks users who imported from package-internal paths directly and not from the top-level package.

More specifically, these are the changes:

* Move and rename`./config/rollup.config.core.ts` to `./rollup.npm.config.js` which now uses our `makeNPMConfigVariants` and `makeBaseNPMConfig` rollup config helper functions to create ESM and CJS transpiled JS, just like in all our other packages. For now we have to change this to JavaScript but we can ofc revisit having TS-based rollup configs in the future.
  * Instead of bundling everything into the `index.js` files, this config now just transpiles the individual modules. This is how we do it in all our other packages. We might have to revisit this strategy for vendoring rrweb and bundling but we can build on top of this PR to do so.
* Move and rename `./config/rollup.worker.config.ts` to `./rollup.worker.config.js` (no changes)
* Update eslint configs
* Fix a few type errors I came across while performing these build changes
* Update `package.json` scripts so that they are in line with the scripts of our other packages. This should simplify the scripts a little.
* Revert #6307 as we now transpile and check/build types separately, like we do with the rest of our packages.
* Revert #6341 as the`__SENTRY_DEBUG__` flag is now set in our rollup helper functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants