Skip to content

Commit 861b01e

Browse files
committed
revert to webpack 1
1 parent 50e0428 commit 861b01e

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
[![Dependency Status](https://david-dm.org/preboot/angular-webpack/status.svg)](https://david-dm.org/preboot/angular-webpack#info=dependencies) [![devDependency Status](https://david-dm.org/preboot/angular-webpack/dev-status.svg)](https://david-dm.org/preboot/angular-webpack#info=devDependencies)
44

5-
A complete, yet simple, starter for Angular using webpack 2.
5+
A complete, yet simple, starter for Angular using Webpack.
66

7-
**NOTE: This workflow is now using Webpack 2 beta. There is a branch with the old workflow if you want to use it.**
8-
9-
This workflow serves as a starting point for building Angular 1.x applications using Webpack 2. Should be noted that apart from the pre-installed angular package, this workflow is pretty much generic.
7+
This workflow serves as a starting point for building Angular 1.x applications using Webpack. Should be noted that apart from the pre-installed angular package, this workflow is pretty much generic.
108

119
* Heavily commented webpack configuration with reasonable defaults.
1210
* ES6, and ES7 support with babel.
@@ -19,8 +17,6 @@ This workflow serves as a starting point for building Angular 1.x applications u
1917

2018
>Warning: Make sure you're using the latest version of Node.js and NPM
2119
22-
[Is Angular 2 Ready Yet?](http://splintercode.github.io/is-angular-2-ready/)
23-
2420
### Quick start
2521

2622
> Clone/Download the repo then edit `app.js` inside [`/src/app/app.js`](/src/app/app.js)
@@ -38,6 +34,7 @@ $ npm install
3834
# start the server
3935
$ npm start
4036
```
37+
4138
go to [http://localhost:8080](http://localhost:8080) in your browser.
4239

4340
# Table of Contents

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = function karmaConfig (config) {
4545
]
4646
},
4747

48-
webpack: require('./webpack.config')('test'),
48+
webpack: require('./webpack.config'),
4949

5050
// Hide webpack build information from output
5151
webpackMiddleware: {

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "1.0.0",
44
"description": "A workflow for Angular made with Webpack",
55
"scripts": {
6-
"build": "rimraf public && webpack --env prod --bail --progress --profile",
7-
"server": "webpack-dev-server --env dev --history-api-fallback --inline --progress",
8-
"test": "karma start --env test",
9-
"test-watch": "karma start -env test --auto-watch --no-single-run",
6+
"build": "rimraf public && webpack --bail --progress --profile",
7+
"server": "webpack-dev-server --history-api-fallback --inline --progress",
8+
"test": "karma start",
9+
"test-watch": "karma start --auto-watch --no-single-run",
1010
"start": "npm run server"
1111
},
1212
"repository": {
@@ -48,7 +48,7 @@
4848
"raw-loader": "^0.5.1",
4949
"rimraf": "^2.5.1",
5050
"style-loader": "^0.13.0",
51-
"webpack": "^2.0.7-beta",
52-
"webpack-dev-server": "^2.0.0-beta"
51+
"webpack": "^1.12.13",
52+
"webpack-dev-server": "^1.14.1"
5353
}
5454
}

webpack.config.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
77
var ExtractTextPlugin = require('extract-text-webpack-plugin');
88
var CopyWebpackPlugin = require('copy-webpack-plugin');
99

10-
module.exports = function makeWebpackConfig (ENV) {
10+
/**
11+
* Env
12+
* Get npm lifecycle event to identify the environment
13+
*/
14+
var ENV = process.env.npm_lifecycle_event;
15+
16+
module.exports = function makeWebpackConfig () {
1117
/**
1218
* Config
1319
* Reference: http://webpack.github.io/docs/configuration.html
@@ -37,15 +43,15 @@ module.exports = function makeWebpackConfig (ENV) {
3743

3844
// Output path from the view of the page
3945
// Uses webpack-dev-server in development
40-
publicPath: ENV === 'prod' ? '/' : 'http://localhost:8080/',
46+
publicPath: ENV === 'build' ? '/' : 'http://localhost:8080/',
4147

4248
// Filename for entry points
4349
// Only adds hash in build mode
44-
filename: ENV === 'prod' ? '[name].[hash].js' : '[name].bundle.js',
50+
filename: ENV === 'build' ? '[name].[hash].js' : '[name].bundle.js',
4551

4652
// Filename for non-entry points
4753
// Only adds hash in build mode
48-
chunkFilename: ENV === 'prod' ? '[name].[hash].js' : '[name].bundle.js'
54+
chunkFilename: ENV === 'build' ? '[name].[hash].js' : '[name].bundle.js'
4955
};
5056

5157
/**
@@ -55,7 +61,7 @@ module.exports = function makeWebpackConfig (ENV) {
5561
*/
5662
if (ENV === 'test') {
5763
config.devtool = 'inline-source-map';
58-
} else if (ENV === 'prod') {
64+
} else if (ENV === 'build') {
5965
config.devtool = 'source-map';
6066
} else {
6167
config.devtool = 'eval-source-map';
@@ -157,12 +163,12 @@ module.exports = function makeWebpackConfig (ENV) {
157163
// Reference: https://github.com/webpack/extract-text-webpack-plugin
158164
// Extract css files
159165
// Disabled when in test mode or not in build mode
160-
new ExtractTextPlugin('[name].[hash].css', {disable: ENV !== 'prod'})
166+
new ExtractTextPlugin('[name].[hash].css', {disable: ENV !== 'build'})
161167
)
162168
}
163169

164170
// Add build specific plugins
165-
if (ENV === 'prod') {
171+
if (ENV === 'build') {
166172
config.plugins.push(
167173
// Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
168174
// Only emit files when there are no errors
@@ -200,4 +206,4 @@ module.exports = function makeWebpackConfig (ENV) {
200206
};
201207

202208
return config;
203-
};
209+
}();

0 commit comments

Comments
 (0)