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' ;
@@ -170,13 +172,16 @@ export function makeTSPlugin(jsVersion) {
170
172
* Creates a Rollup plugin that removes all code between the `__ROLLUP_EXCLUDE_FROM_BUNDLES_BEGIN__`
171
173
* and `__ROLLUP_EXCLUDE_FROM_BUNDLES_END__` comment guards. This is used to exclude the Replay integration
172
174
* from the browser and browser+tracing bundles.
175
+ * If we need to add more such guards in the future, we might want to refactor this into a more generic plugin.
173
176
*/
174
177
export function makeExcludeReplayPlugin ( ) {
175
178
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;
179
+ const browserIndexFilePath = path . resolve ( __dirname , '../../packages/browser/src/index.ts' ) ;
176
180
177
181
const plugin = {
178
- transform ( code ) {
179
- if ( ! replacementRegex . test ( code ) ) {
182
+ transform ( code , id ) {
183
+ const isBrowserIndexFile = path . resolve ( id ) === browserIndexFilePath ;
184
+ if ( ! isBrowserIndexFile || ! replacementRegex . test ( code ) ) {
180
185
return null ;
181
186
}
182
187
You can’t perform that action at this time.
0 commit comments