Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

BabylonJS and TS. Debug, Release, Playground

BabylonJS and TS. Debug, Release, Playground

8Observer8
8Observer8
Babylon.js and TypeScript · · 1 min read
1,900 1

I will show how to use BabylonJS and TypeScript without Webpack, Gulp, Grunt and so on. Your examples will not be very heavy.

My example includes two versions:

  • Debug. AMD + RequireJS. You should use it with Chrome extension for VSCode for breakpoints. And you can use it to public your multi file TypeScript examples on Playground like this: Getting Started Example in TypeScript
  • Release. CommonJS + Browserify + UglifyJS. You should use it to create a bundle of your JS files for production

How to run my example:

npm i browserify -g
npm i uglifyjs -g
npm i typescript -g
  • Install the modules: babylonjs and @types/requirejs (that are included in my packages.json) using this command:

npm install
  • You should comment/uncomment Debug or Release versions:

<!-- Debug -->
<script data-main="dist_client/RequireConfig"
    src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>

<!-- Release -->
<!-- <script src="dist_client/bundle.client.min.js"></script> -->

In Program.ts:

// Debug
Program.Main();

// Release
// window.onload = () => Program.Main();
  • Build Debug Version using this command:
npm run build-debug-client
  • Or build Release Version using this command:
npm run build-release-client


Discussion

Loading comments...