File tree 1 file changed +12
-1
lines changed
packages/nextjs/src/config
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable max-lines */
2
2
import { getSentryRelease } from '@sentry/node' ;
3
- import { dropUndefinedKeys , logger } from '@sentry/utils' ;
3
+ import { dropUndefinedKeys , escapeStringForRegex , logger } from '@sentry/utils' ;
4
4
import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin' ;
5
5
import * as fs from 'fs' ;
6
6
import * as path from 'path' ;
@@ -53,6 +53,8 @@ export function constructWebpackConfigFunction(
53
53
newConfig = userNextConfig . webpack ( newConfig , buildContext ) ;
54
54
}
55
55
56
+ const pageRegex = new RegExp ( `${ escapeStringForRegex ( projectDir ) } (/src)?/pages(/.+)\\.(jsx?|tsx?)` ) ;
57
+
56
58
if ( isServer ) {
57
59
newConfig . module = {
58
60
...newConfig . module ,
@@ -72,6 +74,15 @@ export function constructWebpackConfigFunction(
72
74
} ,
73
75
] ,
74
76
} ,
77
+ {
78
+ test : pageRegex ,
79
+ use : [
80
+ {
81
+ loader : path . resolve ( __dirname , 'loaders/dataFetchersLoader.js' ) ,
82
+ options : { projectDir } ,
83
+ } ,
84
+ ] ,
85
+ } ,
75
86
] ,
76
87
} ;
77
88
}
You can’t perform that action at this time.
0 commit comments