File tree 1 file changed +8
-3
lines changed
packages/@sanity/webpack-loader/src
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ const env = typeof sanityEnv === 'undefined' ? process.env.NODE_ENV : sanityEnv
15
15
function sanityPartLoader ( input ) {
16
16
this . cacheable ( )
17
17
18
+ let buildEnv = sanityEnv
19
+ if ( ! buildEnv ) {
20
+ buildEnv = this . options . devtool ? env : 'production'
21
+ }
22
+
18
23
const qs = this . resourceQuery . substring ( this . resourceQuery . indexOf ( '?' ) )
19
24
const request = ( loaderUtils . parseQuery ( qs ) || { } ) . sanityPart
20
25
@@ -31,14 +36,14 @@ function sanityPartLoader(input) {
31
36
32
37
if ( request . indexOf ( 'config:' ) === 0 ) {
33
38
const config = JSON . parse ( input )
34
- const indent = env === 'production' ? 0 : 2
35
- const reduced = reduceConfig ( config , env )
39
+ const indent = buildEnv === 'production' ? 0 : 2
40
+ const reduced = reduceConfig ( config , buildEnv )
36
41
return `module.exports = ${ JSON . stringify ( reduced , null , indent ) } \n`
37
42
}
38
43
39
44
if ( request === 'sanity:versions' ) {
40
45
const versions = getSanityVersions ( basePath )
41
- const indent = env === 'production' ? 0 : 2
46
+ const indent = buildEnv === 'production' ? 0 : 2
42
47
return `module.exports = ${ JSON . stringify ( versions , null , indent ) } \n`
43
48
}
44
49
You can’t perform that action at this time.
0 commit comments