Skip to content

Commit

Permalink
webpack example
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Dec 30, 2015
1 parent f43b720 commit eb96cb6
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 4 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@

# TODO

- build a webpack sample app -> https://github.com/angular/angular/issues/4278

## angular2-library-example
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/webpack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.idea
npm-debug.log
40 changes: 40 additions & 0 deletions examples/webpack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "ng2-webpack-minimal",
"version": "1.0.0",
"description": "A minimal Webpack-based Angular 2 seed project",
"scripts": {
"start": "webpack-dev-server --colors --display-error-details --content-base src"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jhades/ng2-webpack-minimal.git"
},
"keywords": [
"Angular",
"2",
"Webpack",
"Seed"
],
"author": "[email protected]",
"license": "MIT",
"bugs": {
"url": "https://github.com/jhades/ng2-webpack-minimal/issues"
},
"homepage": "https://github.com/jhades/ng2-webpack-minimal#readme",
"devDependencies": {
"typescript": "^1.7.5",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"angular2": "^2.0.0-beta.0",
"angular2-library-example": "^1.0.5",
"es6-promise": "^3.0.2",
"es6-shim": "^0.34.0",
"ng2-translate": "^1.2.4",
"reflect-metadata": "^0.1.2",
"rxjs": "^5.0.0-beta.0",
"ts-loader": "^0.7.2",
"zone.js": "^0.5.10"
}
}
28 changes: 28 additions & 0 deletions examples/webpack/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'angular2/bundles/angular2-polyfills';
//import 'reflect-metadata';
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {HelloWorld} from 'angular2-library-example/components';


@Component({
selector: 'app',
directives: [HelloWorld],
template: `<div>
<input (keyup)="onKeyUp(input)" #input placeholder="Type Here">
{{message}}
<hello-world></hello-world>
</div>`
})
export class App {

message = "";

onKeyUp(input) {
this.message = input.value;
}

}


bootstrap(App);
14 changes: 14 additions & 0 deletions examples/webpack/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ng2-webpack-minimal</title>
</head>
<body>

<app></app>

<script src="bundle.js"></script>

</body>
</html>
15 changes: 15 additions & 0 deletions examples/webpack/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"declaration": true
},
"exclude": [
"node_modules"
]
}
16 changes: 16 additions & 0 deletions examples/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
entry: "./src/app.ts",
output: {
filename: "bundle.js"
},
devtool: 'source-map',
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.js']
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
},
noParse: [ /.+zone\.js\/dist\/.+/, /.+angular2\/bundles\/.+/ ]
};

0 comments on commit eb96cb6

Please sign in to comment.