Debug, Release, Playground using BabylonJS and TypeScript

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:

In index.html:

<!-- 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

3 Likes

I’m for it

I copied this description to GitHub: GitHub - 8Observer8/babylonjs-npm-getting-started-typescript: Debug, Release, Playground using BabylonJS and TypeScript

I wanted to add specs to BabylonJS projects to Debug and Release versions. I will use Jasmine. I made this simple example using TypeScript: Plunker

You can run the unit test by clicking on “Run Unit Tests” button. But this example does not use Mock-objects. I will make an example how to mix Jasmine mocks and BabylonJS together. I like to write unit tests for my code.