File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ import { constructWebpackConfigFunction } from './webpack';
11
11
export function withSentryConfig (
12
12
userNextConfig : ExportedNextConfig = { } ,
13
13
userSentryWebpackPluginOptions : Partial < SentryWebpackPluginOptions > = { } ,
14
- ) : NextConfigFunction | NextConfigObject {
14
+ ) : NextConfigFunction | Partial < NextConfigObject > {
15
15
// If the user has passed us a function, we need to return a function, so that we have access to `phase` and
16
16
// `defaults` in order to pass them along to the user's function
17
17
if ( typeof userNextConfig === 'function' ) {
18
- return function ( phase : string , defaults : { defaultConfig : NextConfigObject } ) : NextConfigObject {
18
+ return function ( phase : string , defaults : { defaultConfig : NextConfigObject } ) : Partial < NextConfigObject > {
19
19
const materializedUserNextConfig = userNextConfig ( phase , defaults ) ;
20
20
return {
21
21
...materializedUserNextConfig ,
Original file line number Diff line number Diff line change @@ -7,13 +7,13 @@ export type SentryWebpackPlugin = { options: SentryWebpackPluginOptions };
7
7
* Overall Nextjs config
8
8
*/
9
9
10
- export type ExportedNextConfig = NextConfigObject | NextConfigFunction ;
10
+ export type ExportedNextConfig = Partial < NextConfigObject > | NextConfigFunction ;
11
11
12
12
export type NextConfigObject = {
13
13
// custom webpack options
14
- webpack ? : WebpackConfigFunction ;
14
+ webpack : WebpackConfigFunction ;
15
15
// whether to build serverless functions for all pages, not just API routes
16
- target ? : 'server' | 'experimental-serverless-trace' ;
16
+ target : 'server' | 'experimental-serverless-trace' ;
17
17
sentry ?: {
18
18
disableServerWebpackPlugin ?: boolean ;
19
19
disableClientWebpackPlugin ?: boolean ;
@@ -25,8 +25,8 @@ export type NextConfigObject = {
25
25
26
26
export type NextConfigFunction = (
27
27
phase : string ,
28
- defaults : { defaultConfig : { [ key : string ] : unknown } } ,
29
- ) => NextConfigObject ;
28
+ defaults : { defaultConfig : NextConfigObject } ,
29
+ ) => Partial < NextConfigObject > ;
30
30
31
31
/**
32
32
* Webpack config
@@ -56,7 +56,7 @@ export type BuildContext = {
56
56
isServer : boolean ;
57
57
buildId : string ;
58
58
dir : string ;
59
- config : Partial < NextConfigObject > ;
59
+ config : NextConfigObject ;
60
60
webpack : { version : string } ;
61
61
} ;
62
62
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export { SentryWebpackPlugin };
34
34
* @returns The function to set as the nextjs config's `webpack` value
35
35
*/
36
36
export function constructWebpackConfigFunction (
37
- userNextConfig : NextConfigObject = { } ,
37
+ userNextConfig : Partial < NextConfigObject > = { } ,
38
38
userSentryWebpackPluginOptions : Partial < SentryWebpackPluginOptions > = { } ,
39
39
) : WebpackConfigFunction {
40
40
// Will be called by nextjs and passed its default webpack configuration and context data about the build (whether
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ process.env.SENTRY_RELEASE = 'doGsaREgReaT';
58
58
const runtimePhase = 'ball-fetching' ;
59
59
// `defaultConfig` is the defaults for all nextjs options (we don't use these at all in the tests, so for our purposes
60
60
// here the values don't matter)
61
- const defaultsObject = { defaultConfig : { } } ;
61
+ const defaultsObject = { defaultConfig : { } as NextConfigObject } ;
62
62
63
63
/** mocks of the arguments passed to `nextConfig.webpack` */
64
64
const serverWebpackConfig = {
@@ -103,7 +103,7 @@ function getBuildContext(
103
103
dev : false ,
104
104
buildId : 'sItStAyLiEdOwN' ,
105
105
dir : '/Users/Maisey/projects/squirrelChasingSimulator' ,
106
- config : { target : 'server' , ...userNextConfig } ,
106
+ config : { target : 'server' , ...userNextConfig } as NextConfigObject ,
107
107
webpack : { version : webpackVersion } ,
108
108
isServer : buildTarget === 'server' ,
109
109
} ;
You can’t perform that action at this time.
0 commit comments