Skip to content

Commit

Permalink
Adds #26 TypeScript loader eg
Browse files Browse the repository at this point in the history
  • Loading branch information
hegdeashwin committed Feb 27, 2016
1 parent c7af976 commit cb9c891
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
9 changes: 9 additions & 0 deletions codes/example-17/entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Message {
constructor(public msg: string) { }
sayHello() {
return "<h1>" + this.msg + "</h1>";
}
};

var greeter = new Message("Hello World!");
document.body.innerHTML = greeter.sayHello();
11 changes: 11 additions & 0 deletions codes/example-17/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Eg17: TypeScript</title>
</head>
<body>

<script type="text/javascript" src="bundle.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions codes/example-17/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
entry: './entry.ts',
output: {
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
loaders: [{
test: /\.ts$/,
loader: 'ts-loader'
}]
}
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"open": "0.0.5",
"open-browser-webpack-plugin": "0.0.1",
"raw-loader": "^0.5.1",
"style-loader": "^0.13.0"
"style-loader": "^0.13.0",
"ts-loader": "^0.8.1",
"typescript": "^1.8.2"
}
}
9 changes: 9 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "es5",
"sourceMap": false
},
"exclude": [
"node_modules"
]
}

0 comments on commit cb9c891

Please sign in to comment.