Skip to content

Commit

Permalink
Improving minified version
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-moreau committed Oct 23, 2018
1 parent 3cf8807 commit 573ab7f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
11 changes: 8 additions & 3 deletions script/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ build('./build/src/', './build/src/extensions/index.js', './dist/editor.extensio
format: 'global',
globalDeps: {
'babylonjs': 'BABYLON',
'spectorjs': 'SPECTOR'
'spectorjs': 'SPECTOR',
'cannon': 'CANNON',
'earcut': 'Earcut'
},
externals: ['babylonjs', 'cannon', 'earcut'],
minify: true
});

Expand All @@ -64,9 +67,11 @@ build('./build/src/', './build/src/extensions/index.js', './dist/editor.extensio
format: 'cjs',
globalDeps: {
'babylonjs': 'BABYLON',
'spectorjs': 'SPECTOR'
'spectorjs': 'SPECTOR',
'cannon': 'CANNON',
'earcut': 'Earcut'
},
externals: ['javascript-astar', 'litegraph.js'],
externals: ['javascript-astar', 'litegraph.js', 'babylonjs', 'cannon', 'earcut'],
minify: true
});

Expand Down
4 changes: 0 additions & 4 deletions src/extensions/behavior/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {

import Tokenizer, { TokenType } from '../tools/tokenizer';
import { exportScriptString } from '../tools/tools';
import { defineRequire } from '../tools/require';

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

// Instance
CodeExtension.Instance = this;

// require polyfill
defineRequire();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ export {

IExtension, ExtensionConstructor
}

// Polyfills
import { defineRequire } from './tools/require';
defineRequire();
6 changes: 3 additions & 3 deletions src/extensions/tools/require.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import * as EARCUT from 'earcut';

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

export module EDITOR {
export class BehaviorCode {
public static Constructors: any = { };
declare module EDITOR {
class BehaviorCode {
public static Constructors: any;
}
}

Expand Down

0 comments on commit 573ab7f

Please sign in to comment.