@@ -10,6 +10,7 @@ import getBundleDataFromURL from '../utils/getBundleDataFromURL';
1010
1111type Platform = string ;
1212type BundleOptions = { dev ?: boolean ; minify ?: boolean ; alreadySet ?: boolean } ;
13+ type QueryBundleOptions = Omit < BundleOptions , 'alreadySet' > ;
1314type PlatformsBundleOptions = {
1415 [ platform in Platform ] : BundleOptions ;
1516} ;
@@ -105,7 +106,10 @@ export default function setupCompilerRoutes(
105106 hasWarnedDelta = true ;
106107 }
107108
108- const bundleOptionsFromQuery = getBundleOptionsFromQuery ( request . query ) ;
109+ const bundleOptionsFromQuery = getBundleOptionsFromQuery (
110+ request . query ,
111+ cliBundleOptions
112+ ) ;
109113 const isUserChangedOptions = isUserChangedAlreadySetBundleOptions (
110114 bundleOptions [ platform ] ,
111115 bundleOptionsFromQuery
@@ -207,31 +211,38 @@ function makeResponseFromCompilerResults(
207211 return response ;
208212}
209213
210- function areBundleOptionsSet ( bundleOptions : BundleOptions ) {
214+ function areBundleOptionsSet ( bundleOptions : QueryBundleOptions ) {
211215 return bundleOptions . dev !== undefined || bundleOptions . minify !== undefined ;
212216}
213217
214- function getBundleOptionsFromQuery ( query : { minify ?: boolean ; dev ?: boolean } ) {
218+ function getBundleOptionsFromQuery (
219+ query : QueryBundleOptions ,
220+ defaultOptions : BundleOptions
221+ ) {
215222 let bundleOptions : BundleOptions = { } ;
216223
217224 if ( query . minify === true ) {
218225 bundleOptions . minify = true ;
219226 } else if ( query . minify === false ) {
220227 bundleOptions . minify = false ;
228+ } else if ( query . minify === undefined ) {
229+ bundleOptions . minify = defaultOptions . minify ;
221230 }
222231
223232 if ( query . dev === true ) {
224233 bundleOptions . dev = true ;
225234 } else if ( query . dev === false ) {
226235 bundleOptions . dev = false ;
236+ } else if ( query . dev === undefined ) {
237+ bundleOptions . dev = defaultOptions . dev ;
227238 }
228239
229240 return bundleOptions ;
230241}
231242
232243function isUserChangedAlreadySetBundleOptions (
233244 bundleOptions : BundleOptions ,
234- bundleOptionsFromQuery : BundleOptions
245+ bundleOptionsFromQuery : QueryBundleOptions
235246) {
236247 if ( areBundleOptionsSet ( bundleOptionsFromQuery ) ) {
237248 if ( bundleOptions . alreadySet ) {
0 commit comments