Skip to content

Commit

Permalink
fix some broken examples when using the es5 build of PlayCanvas (#5407)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellthompson authored and slimbuck committed Jun 22, 2023
1 parent 4cb1bff commit 81d2d2c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
7 changes: 4 additions & 3 deletions examples/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,16 @@ const builds = [
input: 'src/iframe/index.mjs',
output: {
name: 'bundle',
format: 'umd',
format: 'es',
dir: 'dist/iframe',
sourcemap: process.env.NODE_ENV === 'development' ? 'inline' : false,
sourcemap: process.env.NODE_ENV === 'development' ? 'inline' : false
},
plugins: [
alias({
entries: {
'playcanvas': ENGINE_PATH,
'../../../build/playcanvas.js': ENGINE_PATH
'../../../build/playcanvas.js': ENGINE_PATH,
'pc-alias': ENGINE_PATH.includes('.mjs') ? './pc-es6.mjs' : './pc-es5.mjs'
}
}),
commonjs(),
Expand Down
5 changes: 1 addition & 4 deletions examples/src/iframe/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ import '../../lib/objectValuesPolyfill.js';
import * as observer from '@playcanvas/observer';
import * as pcui from '@playcanvas/pcui/react';
import React from 'react';
import * as pc from '../../../build/playcanvas.js';
import 'pc-alias';
import * as pcx from '../../../build/playcanvas-extras.mjs/index.js';

window.observer = observer;
window.pcui = window.top.pcui || pcui;
window.React = window.top.React || React;
window.pc = pc;
// make pc available outside of the iframe
window.top.pc = pc;
window.pcx = pcx;
4 changes: 4 additions & 0 deletions examples/src/iframe/pc-es5.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pc from '../../../build/playcanvas.js';
window.pc = pc;
// make pc available outside of the iframe
window.top.pc = window.pc;
4 changes: 4 additions & 0 deletions examples/src/iframe/pc-es6.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as pc from '../../../build/playcanvas.js';
window.pc = pc;
// make pc available outside of the iframe
window.top.pc = window.pc;

0 comments on commit 81d2d2c

Please sign in to comment.