File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 8
8
* Typescript plugin docs: https://github.com/ezolenko/rollup-plugin-typescript2
9
9
*/
10
10
11
+ import path from 'path' ;
12
+
11
13
import commonjs from '@rollup/plugin-commonjs' ;
12
14
import deepMerge from 'deepmerge' ;
13
15
import license from 'rollup-plugin-license' ;
@@ -169,13 +171,16 @@ export function makeTSPlugin(jsVersion) {
169
171
* Creates a Rollup plugin that removes all code between the `__ROLLUP_EXCLUDE_FROM_BUNDLES_BEGIN__`
170
172
* and `__ROLLUP_EXCLUDE_FROM_BUNDLES_END__` comment guards. This is used to exclude the Replay integration
171
173
* from the browser and browser+tracing bundles.
174
+ * If we need to add more such guards in the future, we might want to refactor this into a more generic plugin.
172
175
*/
173
176
export function makeExcludeReplayPlugin ( ) {
174
177
const replacementRegex = / \/ \/ _ _ R O L L U P _ E X C L U D E _ F R O M _ B U N D L E S _ B E G I N _ _ ( .| \n ) * _ _ R O L L U P _ E X C L U D E _ F R O M _ B U N D L E S _ E N D _ _ / gm;
178
+ const browserIndexFilePath = path . resolve ( __dirname , '../../packages/browser/src/index.ts' ) ;
175
179
176
180
const plugin = {
177
- transform ( code ) {
178
- if ( ! replacementRegex . test ( code ) ) {
181
+ transform ( code , id ) {
182
+ const isBrowserIndexFile = path . resolve ( id ) === browserIndexFilePath ;
183
+ if ( ! isBrowserIndexFile || ! replacementRegex . test ( code ) ) {
179
184
return null ;
180
185
}
181
186
You can’t perform that action at this time.
0 commit comments