react-webpack-template
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -1,8 +0,17 @@ | ||
var path = require('path'); | ||
'use strict'; | ||
let path = require('path'); | ||
var port = 8000; | ||
var srcPath = path.join(__dirname, '/../src'); | ||
var publicPath = '/assets/'; | ||
let port = 8000; | ||
let srcPath = path.join(__dirname, '/../src'); | ||
let publicPath = '/assets/'; | ||
// Additional npm or bower modules to include in builds | ||
// Add all foreign plugins you may need into this array | ||
// @example: | ||
// let npmBase = path.join(__dirname, '../node_modules'); | ||
// let additionalPaths = [ path.join(npmBase, 'react-bootstrap') ]; | ||
let additionalPaths = []; | ||
module.exports = { | ||
additionalPaths: additionalPaths, | ||
port: port, | ||
@@ -9,0 +18,0 @@ debug: true, |
@@ -1,11 +0,13 @@ | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
var _ = require('lodash'); | ||
'use strict'; | ||
var baseConfig = require('./base'); | ||
let path = require('path'); | ||
let webpack = require('webpack'); | ||
let _ = require('lodash'); | ||
let baseConfig = require('./base'); | ||
// Add needed plugins here | ||
var BowerWebpackPlugin = require('bower-webpack-plugin'); | ||
let BowerWebpackPlugin = require('bower-webpack-plugin'); | ||
var config = _.merge({ | ||
let config = _.merge({ | ||
entry: [ | ||
@@ -31,5 +33,8 @@ 'webpack-dev-server/client?http://127.0.0.1:8000', | ||
loader: 'react-hot!babel-loader', | ||
include: path.join(__dirname, '/../src') | ||
include: [].concat( | ||
config.additionalPaths, | ||
[ path.join(__dirname, '/../src') ] | ||
) | ||
}); | ||
module.exports = config; |
@@ -1,11 +0,13 @@ | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
var _ = require('lodash'); | ||
'use strict'; | ||
var baseConfig = require('./base'); | ||
let path = require('path'); | ||
let webpack = require('webpack'); | ||
let _ = require('lodash'); | ||
let baseConfig = require('./base'); | ||
// Add needed plugins here | ||
var BowerWebpackPlugin = require('bower-webpack-plugin'); | ||
let BowerWebpackPlugin = require('bower-webpack-plugin'); | ||
var config = _.merge({ | ||
let config = _.merge({ | ||
entry: path.join(__dirname, '../src/components/run'), | ||
@@ -32,5 +34,8 @@ cache: false, | ||
loader: 'babel', | ||
include: path.join(__dirname, '/../src') | ||
include: [].concat( | ||
config.additionalPaths, | ||
[ path.join(__dirname, '/../src') ] | ||
) | ||
}); | ||
module.exports = config; |
@@ -1,6 +0,10 @@ | ||
var path = require('path'); | ||
var srcPath = path.join(__dirname, '/../src/'); | ||
'use strict'; | ||
let path = require('path'); | ||
let srcPath = path.join(__dirname, '/../src/'); | ||
let baseConfig = require('./base'); | ||
// Add needed plugins here | ||
var BowerWebpackPlugin = require('bower-webpack-plugin'); | ||
let BowerWebpackPlugin = require('bower-webpack-plugin'); | ||
@@ -27,6 +31,9 @@ module.exports = { | ||
loader: 'babel-loader', | ||
include: [ | ||
path.join(__dirname, '/../src'), | ||
path.join(__dirname, '/../test') | ||
] | ||
include: [].concat( | ||
baseConfig.additionalPaths, | ||
[ | ||
path.join(__dirname, '/../src'), | ||
path.join(__dirname, '/../test') | ||
] | ||
) | ||
} | ||
@@ -33,0 +40,0 @@ ] |
# react-webpack-template - Changelog | ||
## 1.1.0: | ||
1. Added support for easier webpack include management (can now be set via cfg/base.js, see README.md) | ||
## 1.0.3: | ||
1. Support for config independent settings in ```src/config/base.js``` (provided by [sthzg](https://github.com/sthzg)) | ||
2. Fixed eslint loader path (provided by [HelloYie](https://github.com/HelloYie)) | ||
3. Added support for babel-eslint (as suggested in https://github.com/newtriks/generator-react-webpack/issues/173) | ||
## 1.0.2: | ||
@@ -4,0 +14,0 @@ |
{ | ||
"name": "react-webpack-template", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "A base skeleton template for react and webpack without task runners", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
@@ -28,2 +28,3 @@ # Welcome to react-webpack-template | ||
The template uses webpack as build tool to serve files and run tests. The following commands are available: | ||
```bash | ||
@@ -57,2 +58,3 @@ # Start for development | ||
You can also use your globally installed version of webpack like this: | ||
```bash | ||
@@ -70,2 +72,14 @@ # Build or run the dev version: | ||
``` | ||
## Including third party modules (e.g. from npm) | ||
The default setting for the webpack configuration is to only include the ```src``` and ```test``` directories. If you want to add any modules from npm, you have to add them in ```cfg/base.js```. One example is: | ||
```javascript | ||
// Somewhere on top of the file: | ||
let npmBase = path.join(__dirname, '../node_modules'); | ||
let additionalPaths = [ path.join(npmBase, 'react-bootstrap') ]; | ||
``` | ||
All entries added to the additionalPaths array will be appended to the include path for babel. | ||
## A note on unit testing | ||
@@ -72,0 +86,0 @@ When running tests, coverage information (provided via Istanbul) will also be written into the ```coverage/``` directory. If you do not need this, just comment out or remove the section in ```karma.conf``` like this: |
55911
403
114