Skip to content
Permalink
Browse files

Merge branch 'webpack'

  • Loading branch information...
GeorgDangl committed Feb 21, 2017
2 parents cdb988a + c964784 commit bc1a15d2dc81c9e228e21dcf8b8ee515f1878a72
@@ -249,4 +249,4 @@ src/NetCoreHeroes/App/**/*.js
src/NetCoreHeroes/App/**/*.map

# Generated client app in wwwroot folder
src/NetCoreHeroes/wwwroot/app/*
src/NetCoreHeroes/wwwroot/dist/*
@@ -15,7 +15,7 @@ import { Component } from '@angular/core';
</nav>
<router-outlet></router-outlet>
`,
styleUrls: ['app/app.component.css']
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Tour of Heroes';
@@ -5,8 +5,8 @@ import { Router } from '@angular/router';

@Component({
selector: 'my-dashboard',
templateUrl: '/app/dashboard.component.html',
styleUrls: ['app/dashboard.component.css']
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})


@@ -5,8 +5,8 @@ import { HeroService } from './hero.service';

@Component({
selector: 'my-hero-detail',
templateUrl: '/app/hero-detail.component.html',
styleUrls: ['app/hero-detail.component.css']
templateUrl: './hero-detail.component.html',
styleUrls: ['./hero-detail.component.css']
})

export class HeroDetailComponent implements OnInit {
@@ -5,8 +5,8 @@ import { Router } from '@angular/router';

@Component({
selector: 'my-heroes',
templateUrl: '/app/heroes.component.html',
styleUrls: ['app/heroes.component.css']
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.css']
})

export class HeroesComponent implements OnInit {
@@ -1,4 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import 'zone.js';
import 'reflect-metadata';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
require("style-loader!raw-loader!./styles.css");

platformBrowserDynamic().bootstrapModule(AppModule);
@@ -12,23 +12,11 @@
<!--[if lt IE 9]>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css" />
<![endif]-->

<link rel="stylesheet" href="~/app/styles.css">

<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="lib/core-js/client/shim.min.js"></script>
<script src="lib/zone.js/dist/zone.js"></script>
<script src="lib/reflect-metadata/Reflect.js"></script>
<script src="lib/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>Loading...</my-app>
<a class="github-fork-ribbon" href="https://github.com/GeorgDangl/NetCoreHeroes" title="Fork me on GitHub">Fork me on GitHub</a>
<script src="~/dist/vendor.js"></script>
<script src="~/dist/main.js"></script>
</body>
</html>

This file was deleted.

@@ -2,10 +2,10 @@
"name": "net-core-heroes",
"version": "1.0.0",
"scripts": {
"postinstall": "gulp copyClientDeps",
"copyClientApp": "gulp copyApp",
"tsc": "tsc",
"tsc:w": "tsc -w"
"tsc:w": "tsc -w",
"webpack": "webpack --config webpack.config.js",
"webpack:vendor": "webpack --config webpack.config.vendor.js"
},
"license": "ISC",
"dependencies": {
@@ -18,20 +18,25 @@
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"systemjs": "0.19.27",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.23",
"es6-shim": "0.35.1"
},
"devDependencies": {
"systemjs": "0.19.27",
"typescript": "2.1.6",
"webpack": "2.2.1",
"awesome-typescript-loader": "3.0.4",
"angular2-template-loader": "0.6.2",
"css-loader": "0.26.1",
"to-string-loader": "1.1.5",
"html-loader": "0.4.4",
"style-loader": "0.13.1",
"raw-loader": "0.5.1",
"@types/node": "^6.0.42",
"@types/jasmine": "2.5.43",
"@types/core-js": "0.9.35",
"gulp": "3.9.1",
"rimraf": "2.6.0",
"merge-stream": "1.0.0"
"@types/core-js": "0.9.35"
}
}
@@ -64,8 +64,7 @@
},

"scripts": {
"prepublish": "npm install",
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ],
"postcompile": "npm run copyClientApp"
"prepublish": [ "npm install" , "npm run webpack:vendor", "npm run webpack" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
@@ -10,8 +10,8 @@
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder in wwwroot
App: './wwwroot/app',
// our app is within the app folder
App: 'App',
// angular bundles
'@angular/core': 'lib:@angular/core/bundles/core.umd.js',
'@angular/core/testing': 'lib:@angular/core/bundles/core-testing.umd.js',
@@ -32,7 +32,7 @@
// packages tells the System loader how to load when no filename and/or no extension
packages: {
App: {
main: './wwwroot/app/main.js',
main: './App/main.js',
defaultExtension: 'js'
},
rxjs: {
@@ -1,14 +1,12 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "wwwroot/app",
"types": ["node", "jasmine","core-js"]
},
"compileOnSave": true,
@@ -0,0 +1,29 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
context: __dirname,
resolve: { extensions: ['.ts', '.js'] }, // .ts is first so that .ts files are preffered over js file, this ensures
// that angular 2 components are passed through the angular2-template-loader and have their templates and styles inlined
entry: { 'main': './App/main.ts' },
output: {
path: path.join(__dirname, './wwwroot/dist'),
filename: '[name].js',
publicPath: '/dist/'
},
module: {
rules: [
{ test: /\.ts$/, include: /App/, use: ['awesome-typescript-loader?silent=true', 'angular2-template-loader']
},
{ test: /\.html$/, use: 'html-loader?minimize=false' },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] }
]
},
plugins: [
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./wwwroot/dist/vendor-manifest.json')
}),
new webpack.optimize.UglifyJsPlugin()
]
};
@@ -0,0 +1,34 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
resolve: { extensions: ['.js'] },
entry: {
vendor: [
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/http',
'@angular/router',
'@angular/forms',
'es6-shim',
'rxjs',
'zone.js'
]
},
output: {
path: path.join(__dirname, 'wwwroot', 'dist'),
publicPath: '/dist/',
filename: '[name].js',
library: '[name]_[hash]'
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
name: '[name]_[hash]'
}),
new webpack.optimize.UglifyJsPlugin()
]
}

This file was deleted.

0 comments on commit bc1a15d

Please sign in to comment.
You can’t perform that action at this time.