File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 179179 try {
180180 xmlHttp . onreadystatechange = null ;
181181 const snippet = JSON . parse ( xmlHttp . responseText ) ;
182- let code = JSON . parse ( snippet . jsonPayload ) . code . toString ( )
182+ let code = JSON . parse ( snippet . jsonPayload ) . code . toString ( ) ;
183+
184+ // Check if this is a v2 manifest and extract the entry file's code
185+ // TODO: Handle multi-file playgrounds
186+ try {
187+ const manifestPayload = JSON . parse ( code ) ;
188+ if ( manifestPayload . v === 2 ) {
189+ code = manifestPayload . files [ manifestPayload . entry ]
190+ . replace ( / e x p o r t + d e f a u l t + / g, "" )
191+ . replace ( / e x p o r t + / g, "" ) ;
192+ }
193+ } catch ( e ) {
194+ // Not a manifest, proceed as usual
195+ }
196+
197+ code = code
183198 . replace ( / " \/ t e x t u r e s \/ / g, '"' + pgRoot + "/textures/" )
184199 . replace ( / " t e x t u r e s \/ / g, '"' + pgRoot + "/textures/" )
185200 . replace ( / \/ s c e n e s \/ / g, pgRoot + "/scenes/" )
You can’t perform that action at this time.
0 commit comments