Skip to content

Commit

Permalink
Tweak to dev build
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Dec 10, 2023
1 parent 86b1c39 commit d4c3d45
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sandbox/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<canvas id="game"></canvas>
</div>
<script type="text/javascript" src="../stats/stats.js"></script>
<script type="text/javascript" src="../lib/excalibur.instrumented.js"></script>
<script type="text/javascript" src="../lib/excalibur.dev.js"></script>
<script type="text/javascript" src="../excalibur-dev-tools/dev-tools.js"></script>
<script type="text/javascript" src="../src/game.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion sandbox/tests/drawcalls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div># Items:<span id="drawn-items">0</span></div>
<button id="add">Add 1000 Items</button>
</div>
<script src="../../lib/excalibur.instrumented.js"></script>
<script src="../../lib/excalibur.dev.js"></script>
<script src="./index.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions src/engine/Profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ export interface ProfilerData {
name: string,
start: number,
duration: number,
type: 'task' | 'sub-task',
value: number,
children: ProfilerData[];
}
export class Profiler {
static enabled = false;
static data: ProfilerData = {
name: 'root',
type: 'task',
start: performance.now(),
value: performance.now(), // store the start time
duration: 0,
Expand All @@ -23,6 +25,7 @@ export class Profiler {
Profiler.data = {
name: 'root',
start,
type: 'task',
value: start, // store the start time
duration: 0,
children: []
Expand All @@ -38,6 +41,7 @@ export class Profiler {
const frame: ProfilerData = {
name,
start,
type: 'sub-task',
value: start,
duration: 0,
children: []
Expand Down
10 changes: 5 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ const removeInstrumentation = {
}
}

const defaultConfig = ({version, env, useInstrumentation}) => ({
mode: 'production',
const defaultConfig = ({mode, version, env, useInstrumentation}) => ({
mode: mode ?? 'production',
devtool: 'source-map',
entry: useInstrumentation ? {
'excalibur.instrumented': './index.ts'
'excalibur.dev': './index.ts'
}
: {
excalibur: './index.ts',
Expand Down Expand Up @@ -127,7 +127,7 @@ module.exports = (env, argv) => {
const version = process.env.release ? versioner.getReleaseVersion() : versioner.getAlphaVersion();
console.log('[version]:', version);
return [
defaultConfig({version, env, useInstrumentation: true}),
defaultConfig({version, env, useInstrumentation: false})
defaultConfig({mode: 'development', version, env, useInstrumentation: true}),
defaultConfig({mode: 'production', version, env, useInstrumentation: false})
];
};

0 comments on commit d4c3d45

Please sign in to comment.