Skip to content

Commit b929102

Browse files
committed
Merge pull request #17 from opiepj/bugfix/webpack
fix build errors.
2 parents 4c6d368 + d9749d4 commit b929102

File tree

7 files changed

+58
-55
lines changed

7 files changed

+58
-55
lines changed

src/app/components/app.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<header>
22
<div layout="row" class="top-nav ac-default-theme">
33
<img src="angular-shield.png" alt="Angular2" height="54" width="54">
4-
<span class="logo">{{ name | capitalize }} + Webpack</span>
4+
<span class="logo">{{ name | capitalize }} + Patrcik + Webpack</span>
55
<ul>
66
<li class="l-left">
77
<a [router-link]=" ['/home'] "class="top-nav-button ac-default-theme">Home</a>
@@ -10,10 +10,7 @@
1010
<a [router-link]=" ['/dashboard'] "class="top-nav-button ac-default-theme">Dashboard</a>
1111
</li>
1212
<li class="l-left">
13-
<a [router-link]=" ['/todo'] "class="top-nav-button ac-default-theme">Todo</a>
14-
</li>
15-
<li class="l-left">
16-
<a [router-link]=" ['/rxjs-examples', 'search'] "class="top-nav-button ac-default-theme">RxJs Examples</a>
13+
<a [router-link]=" ['/example-modules', 'search'] "class="top-nav-button ac-default-theme">Example Modules</a>
1714
</li>
1815
</ul>
1916
</div>

src/app/components/example-modules/example-modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {Component, View, CSSClass} from 'angular2/angular2';
55
import {RouteConfig, routerDirectives} from 'angular2/router';
66
// Modules
77
import {Tictactoe} from './tictactoe-module/tictactoe';
8-
import {Search} from '.search-module/search';
8+
import {Search} from './search-module/search';
99
// View
1010
let template = require('./example-modules.html');
1111
let styles = require('./example-modules.css')

src/app/components/example-modules/search-module/directives/autosuggest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Angular 2
44
import {Directive, View, EventEmitter, ElementRef, LifecycleEvent} from 'angular2/angular2';
55

6-
import {Github} from './Github';
6+
import {Github} from '../services/github';
77
// RxJs
88
import * as Rx from 'rx';
99

src/app/components/example-modules/tictactoe-module/directives/board.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// Angular 2
44
import {Component, View, EventEmitter, coreDirectives} from 'angular2/angular2';
55

6-
let styles = require('./styles/board.css');
7-
let template = require('./views/board.html');
6+
let styles = require('../styles/board.css');
7+
let template = require('../views/board.html');
88

99
@Component({
1010
selector: 'board',

src/app/pipes/pipes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import {Pipes} from 'angular2/change_detection';
88
* App Pipes
99
*/
1010
import {capitalize} from './Capitalize/Capitalize-Pipe';
11-
import {rxAsync} from './RxPipe';
11+
import {rxAsync} from './rx/rxpipe';
1212

1313
export var appPipes = [
1414
Pipes.extend({
1515
'async': rxAsync,
1616
'capitalize': capitalize
17-
// add more pipes to this Map
1817
})
1918
];
72.6 KB
Loading

webpack.config.js

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ var NODE_ENV = process.env.NODE_ENV || 'development';
77
// Node
88
var webpack = require('webpack');
99
var path = require('path');
10-
var pkg = require('./package.json');
10+
var pkg = require('./package.json');
1111

1212
// Webpack Plugins
1313
var OccurenceOrderPlugin = webpack.optimize.OccurenceOrderPlugin;
14-
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
14+
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
1515
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
16-
var DedupePlugin = webpack.optimize.DedupePlugin;
17-
var DefinePlugin = webpack.DefinePlugin;
18-
var BannerPlugin = webpack.BannerPlugin;
16+
var DedupePlugin = webpack.optimize.DedupePlugin;
17+
var DefinePlugin = webpack.DefinePlugin;
18+
var BannerPlugin = webpack.BannerPlugin;
1919

2020

2121
/*
@@ -54,15 +54,6 @@ var config = {
5454
*/
5555

5656
'./src/app/bootstrap'
57-
],
58-
'app-simple': [
59-
// Simple Version of App
60-
61-
/*
62-
* include any 3rd party js lib here
63-
*/
64-
65-
'./src/app-simple/bootstrap'
6657
]
6758
},
6859

@@ -73,12 +64,12 @@ var config = {
7364
// filename: '[name].[hash].js',
7465
sourceMapFilename: '[name].js.map',
7566
chunkFilename: '[id].chunk.js'
76-
// publicPath: 'http://mycdn.com/'
67+
// publicPath: 'http://mycdn.com/'
7768
},
7869

7970
resolve: {
8071
root: __dirname,
81-
extensions: ['','.ts','.js','.json'],
72+
extensions: ['', '.ts', '.js', '.json'],
8273
alias: {
8374
// we can switch between development and production
8475
// 'angular2': 'node_modules/angular2/ts',
@@ -105,16 +96,28 @@ var config = {
10596
module: {
10697
loaders: [
10798
// Support for *.json files.
108-
{ test: /\.json$/, loader: 'json' },
99+
{
100+
test: /\.json$/,
101+
loader: 'json'
102+
},
109103

110104
// Support for CSS as raw text
111-
{ test: /\.css$/, loader: 'raw' },
105+
{
106+
test: /\.css$/,
107+
loader: 'raw'
108+
},
112109

113110
// support for .html as raw text
114-
{ test: /\.html$/, loader: 'raw' },
111+
{
112+
test: /\.html$/,
113+
loader: 'raw'
114+
},
115115

116116
// Support for .ts files.
117-
{ test: /\.ts$/, loader: 'typescript-simple?ignoreWarnings[]=2345', exclude: [
117+
{
118+
test: /\.ts$/,
119+
loader: 'typescript-simple?ignoreWarnings[]=2345',
120+
exclude: [
118121
/\.spec\.ts$/,
119122
/\.e2e\.ts$/,
120123
/web_modules/,
@@ -130,7 +133,10 @@ var config = {
130133

131134
// plugins: plugins, // see below
132135
context: __dirname,
133-
stats: { colors: true, reasons: true }
136+
stats: {
137+
colors: true,
138+
reasons: true
139+
}
134140
};
135141

136142

@@ -150,50 +156,51 @@ var commons_chunks_plugins = [
150156
//
151157
var environment_plugins = {
152158

153-
all: [
159+
all: [
154160
new DefinePlugin({
155-
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
156-
'VERSION': pkg.version
157-
}),
161+
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
162+
'VERSION': pkg.version
163+
}),
158164
new OccurenceOrderPlugin(),
159165
new DedupePlugin(),
160166
],
161167

162-
production: [
168+
production: [
163169
new UglifyJsPlugin({
164-
compress: {
165-
warnings: false,
166-
drop_debugger: false
167-
},
168-
output: {
169-
comments: false
170-
},
171-
beautify: false
172-
}),
173-
new BannerPlugin(getBanner(), {entryOnly: true})
170+
compress: {
171+
warnings: false,
172+
drop_debugger: false
173+
},
174+
output: {
175+
comments: false
176+
},
177+
beautify: false
178+
}),
179+
new BannerPlugin(getBanner(), {
180+
entryOnly: true
181+
})
174182
],
175183

176-
development: [
184+
development: [
177185
/* Dev Plugin */
178186
// new webpack.HotModuleReplacementPlugin(),
179187
]
180188

181-
}//env
189+
} //env
182190

183191
if (NODE_ENV === 'production') {
184192
// replace filename `.js` with `.min.js`
185193
config.output.filename = config.output.filename.replace('.js', '.min.js');
186194
config.output.sourceMapFilename = config.output.sourceMapFilename.replace('.js', '.min.js');
187-
commons_chunks_plugins = commons_chunks_plugins.map(function(chunk) {
195+
commons_chunks_plugins = commons_chunks_plugins.map(function (chunk) {
188196
return chunk.filename.replace('.js', '.min.js');
189197
});
190-
}
191-
else if (NODE_ENV === 'development') {
198+
} else if (NODE_ENV === 'development') {
192199
// any development actions here
193200
}
194201

195202
// create CommonsChunkPlugin instance for each config
196-
var combine_common_chunks = commons_chunks_plugins.map(function(config) {
203+
var combine_common_chunks = commons_chunks_plugins.map(function (config) {
197204
return new CommonsChunkPlugin(config);
198205
});
199206

@@ -205,15 +212,15 @@ module.exports = config;
205212

206213
// Helper functions
207214
function getBanner() {
208-
return 'Angular2 Webpack Starter v'+ pkg.version +' by @gdi2990 from @AngularClass';
215+
return 'Angular2.0 App v' + pkg.version;
209216
}
210217

211218
function root(args) {
212219
args = sliceArgs(arguments, 0);
213220
return path.join.apply(path, [__dirname].concat(args));
214221
}
222+
215223
function rootNode(args) {
216224
args = sliceArgs(arguments, 0);
217225
return root.apply(path, ['node_modules'].concat(args));
218226
}
219-

0 commit comments

Comments
 (0)