RxJS Configuration and setup - Tuong-Nguyen/Angular-D3-Cometd GitHub Wiki

  • Create tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true
  }
}
  • Create main.ts typescript file for entry point
// Our bootstrap code
alert('Ok!!');
  • Create webpack.config.js
module.exports =  {
    entry: "./main", // input typescript file
    output: { filename: "app.js" }, // output javascript file
    module: {
        loaders: [
            {
                test: /.ts$/,
                loader: "ts-loader"
            }
        ]
    },
    resolve: {
        extensions: [".ts", ".js"]
    }
}
  • Create index.html that uses app.js output script file
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hello RxJS</title>
</head>
<body>
<script src="app.js"></script>
</body>
</html>
  • Update package.json to add some npm script
{
  // ...
  "scripts": {
    "start": "webpack-dev-server --watch --inline",
    "postinstall": "typings install"
  },
  // ...
}
  • Open cmd start server
npm start
⚠️ **GitHub.com Fallback** ⚠️