Skip to content

Commit 573ab7f

Browse files
committed
Improving minified version
1 parent 3cf8807 commit 573ab7f

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

script/bundle.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ build('./build/src/', './build/src/extensions/index.js', './dist/editor.extensio
5454
format: 'global',
5555
globalDeps: {
5656
'babylonjs': 'BABYLON',
57-
'spectorjs': 'SPECTOR'
57+
'spectorjs': 'SPECTOR',
58+
'cannon': 'CANNON',
59+
'earcut': 'Earcut'
5860
},
61+
externals: ['babylonjs', 'cannon', 'earcut'],
5962
minify: true
6063
});
6164

@@ -64,9 +67,11 @@ build('./build/src/', './build/src/extensions/index.js', './dist/editor.extensio
6467
format: 'cjs',
6568
globalDeps: {
6669
'babylonjs': 'BABYLON',
67-
'spectorjs': 'SPECTOR'
70+
'spectorjs': 'SPECTOR',
71+
'cannon': 'CANNON',
72+
'earcut': 'Earcut'
6873
},
69-
externals: ['javascript-astar', 'litegraph.js'],
74+
externals: ['javascript-astar', 'litegraph.js', 'babylonjs', 'cannon', 'earcut'],
7075
minify: true
7176
});
7277

src/extensions/behavior/code.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77

88
import Tokenizer, { TokenType } from '../tools/tokenizer';
99
import { exportScriptString } from '../tools/tools';
10-
import { defineRequire } from '../tools/require';
1110

1211
import { IStringDictionary } from '../typings/typings';
1312
import { IAssetComponent, AssetElement } from '../../shared/asset';
@@ -82,9 +81,6 @@ export default class CodeExtension extends Extension<BehaviorMetadata> implement
8281

8382
// Instance
8483
CodeExtension.Instance = this;
85-
86-
// require polyfill
87-
defineRequire();
8884
}
8985

9086
/**

src/extensions/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ export {
2727

2828
IExtension, ExtensionConstructor
2929
}
30+
31+
// Polyfills
32+
import { defineRequire } from './tools/require';
33+
defineRequire();

src/extensions/tools/require.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import * as EARCUT from 'earcut';
44

55
import CodeExtension from '../behavior/code';
66

7-
export module EDITOR {
8-
export class BehaviorCode {
9-
public static Constructors: any = { };
7+
declare module EDITOR {
8+
class BehaviorCode {
9+
public static Constructors: any;
1010
}
1111
}
1212

0 commit comments

Comments
 (0)