-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(replay): Use Monorepo's rollup config to build Replay (#6343)
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
- Loading branch information
Showing
14 changed files
with
70 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
node_modules | ||
/*.tgz | ||
.eslintcache | ||
dist | ||
build |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import replace from '@rollup/plugin-replace'; | ||
|
||
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index'; | ||
|
||
import pkg from './package.json'; | ||
|
||
export default makeNPMConfigVariants( | ||
makeBaseNPMConfig({ | ||
hasBundles: true, | ||
packageSpecificConfig: { | ||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})], | ||
plugins: [ | ||
// TODO: Remove this - replay version will be in sync w/ SDK version | ||
replace({ | ||
preventAssignment: true, | ||
values: { | ||
__SENTRY_REPLAY_VERSION__: JSON.stringify(pkg.version), | ||
}, | ||
}), | ||
], | ||
output: { | ||
// set exports to 'named' or 'auto' so that rollup doesn't warn about | ||
// the default export in `worker/worker.js` | ||
exports: 'named', | ||
}, | ||
}, | ||
}), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
|
||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationMap": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "build/npm/types" | ||
} | ||
} |