BabylonJS and TS. Debug, Release, Playground
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:
- You should to download my example here: babylonjs-npm-getting-started-typescript.zip or from GitHub: https://github.com/8Observer8/babylonjs-npm-getting-started-typescript
-
Install Browserify, UglifyJS and TypeScript globally:
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