@@ -122,29 +122,35 @@ export interface StoreOptions {
122122 showOutput ?: boolean
123123 // loose type to allow getting from the URL without inducing a typing error
124124 outputMode ?: OutputModes | string
125+ productionMode ?: boolean
125126 defaultVueRuntimeURL ?: string
127+ defaultVueRuntimeProdURL ?: string
126128 defaultVueServerRendererURL ?: string
127129}
128130
129131export class ReplStore implements Store {
130132 state : StoreState
131133 compiler = defaultCompiler
132134 vueVersion ?: string
135+ productionMode = false
133136 options ?: SFCOptions
134137 initialShowOutput : boolean
135138 initialOutputMode : OutputModes
136139 reloadLanguageTools : undefined | ( ( ) => void )
137140
138- private defaultVueRuntimeURL : string
141+ private defaultVueRuntimeDevURL : string
142+ private defaultVueRuntimeProdURL : string
139143 private defaultVueServerRendererURL : string
140144 private pendingCompiler : Promise < any > | null = null
141145
142146 constructor ( {
143147 serializedState = '' ,
144148 defaultVueRuntimeURL = `https://cdn.jsdelivr.net/npm/@vue/runtime-dom@${ version } /dist/runtime-dom.esm-browser.js` ,
149+ defaultVueRuntimeProdURL = `https://cdn.jsdelivr.net/npm/@vue/runtime-dom@${ version } /dist/runtime-dom.esm-browser.prod.js` ,
145150 defaultVueServerRendererURL = `https://cdn.jsdelivr.net/npm/@vue/server-renderer@${ version } /dist/server-renderer.esm-browser.js` ,
146151 showOutput = false ,
147152 outputMode = 'preview' ,
153+ productionMode = false ,
148154 } : StoreOptions = { } ) {
149155 const files : StoreState [ 'files' ] = { }
150156
@@ -157,7 +163,9 @@ export class ReplStore implements Store {
157163 setFile ( files , defaultMainFile , welcomeCode )
158164 }
159165
160- this . defaultVueRuntimeURL = defaultVueRuntimeURL
166+ this . productionMode = productionMode
167+ this . defaultVueRuntimeDevURL = defaultVueRuntimeURL
168+ this . defaultVueRuntimeProdURL = defaultVueRuntimeProdURL
161169 this . defaultVueServerRendererURL = defaultVueServerRendererURL
162170 this . initialShowOutput = showOutput
163171 this . initialOutputMode = outputMode as OutputModes
@@ -182,6 +190,12 @@ export class ReplStore implements Store {
182190 this . initTsConfig ( )
183191 }
184192
193+ get defaultVueRuntimeURL ( ) : string {
194+ return this . productionMode
195+ ? this . defaultVueRuntimeProdURL
196+ : this . defaultVueRuntimeDevURL
197+ }
198+
185199 // don't start compiling until the options are set
186200 init ( ) {
187201 watchEffect ( ( ) =>
@@ -408,7 +422,10 @@ export class ReplStore implements Store {
408422 async setVueVersion ( version : string ) {
409423 this . vueVersion = version
410424 const compilerUrl = `https://cdn.jsdelivr.net/npm/@vue/compiler-sfc@${ version } /dist/compiler-sfc.esm-browser.js`
411- const runtimeUrl = `https://cdn.jsdelivr.net/npm/@vue/runtime-dom@${ version } /dist/runtime-dom.esm-browser.js`
425+ // differentiate prod/dev for runtime
426+ const runtimeUrl = `https://cdn.jsdelivr.net/npm/@vue/runtime-dom@${ version } /dist/runtime-dom.esm-browser${
427+ this . productionMode ? `.prod` : ``
428+ } .js`
412429 const ssrUrl = `https://cdn.jsdelivr.net/npm/@vue/server-renderer@${ version } /dist/server-renderer.esm-browser.js`
413430 this . pendingCompiler = import ( /* @vite -ignore */ compilerUrl )
414431 this . compiler = await this . pendingCompiler
@@ -438,6 +455,15 @@ export class ReplStore implements Store {
438455 this . forceSandboxReset ( )
439456 console . info ( `[@vue/repl] Now using default Vue version` )
440457 }
458+
459+ toggleProduction ( ) {
460+ this . productionMode = ! this . productionMode
461+ if ( this . vueVersion ) {
462+ this . setVueVersion ( this . vueVersion )
463+ } else {
464+ this . resetVueVersion ( )
465+ }
466+ }
441467}
442468
443469function setFile (
0 commit comments