Skip to content

Commit 561ef7c

Browse files
committed
Added support for external babel parsing via dynamic webpack include
1 parent 646a24e commit 561ef7c

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@ You may use this template either directly (by cloning this git repository) or by
99
## Features
1010
The following features are currently included out of the box:
1111

12-
- [x] Webpack 2 setup to get you started (including basic support for LESS/SASS/SCSS/Stylus and PostCSS)
13-
- [x] CSS Modules support via https://github.com/gajus/react-css-modules
12+
- [x] Webpack 2 setup to get you started (including basic support for LESS/SASS/SCSS/Stylus)
13+
- [x] CSS-Modules support via https://github.com/gajus/react-css-modules
1414
- [x] Babel 6 to transpile ES2015 and JSX
1515
- [x] Latest stable React Version (v15.0)
1616
- [x] [Karma](http://karma-runner.github.io), [Mocha](https://mochajs.org), [Chai](http://chaijs.com) and [Enzyme](http://airbnb.io/projects/enzyme/) for easier unit testing
1717
- [x] Istanbul with Isparta to collect coverage information
1818
- [x] Preconfigured .editorconfig file
1919
- [x] Preconfigured eslint configuration, based on airbnb
2020

21+
## Whats new in Version 2.x?
22+
23+
- Support for Bower-Webpack has been removed. Most modules are fetched via npm anyway.
24+
- Support for the global styles folder is deprecated. This function will be removed in one of the next versions.
25+
2126
## Common Questions:
2227

2328
- I want to use react-router, but I dont know how to set it up:

conf/webpack/Base.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@
44
'use strict';
55

66
const path = require('path');
7+
const npmBase = path.join(__dirname, '../../node_modules');
78

89
class WebpackBaseConfig {
910

1011
constructor() {
1112
this._config = {};
1213
}
1314

15+
/**
16+
* Get the list of included packages
17+
* @return {Array} List of included packages
18+
*/
19+
get includedPackages() {
20+
return [].map((pkg) => path.join(npmBase, pkg));
21+
}
22+
1423
/**
1524
* Set the config data.
1625
* This will always return a new config
@@ -127,9 +136,10 @@ class WebpackBaseConfig {
127136
},
128137
{
129138
test: /\.(js|jsx)$/,
130-
include: [
131-
this.srcPathAbsolute
132-
],
139+
include: [].concat(
140+
this.includedPackages,
141+
[this.srcPathAbsolute]
142+
),
133143
loaders: ['react-hot', 'babel']
134144
}
135145
]

conf/webpack/Test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ class WebpackTestConfig extends WebpackBaseConfig {
8181
query: {
8282
presets: ['airbnb']
8383
},
84-
include: [
85-
this.srcPathAbsolute,
86-
this.testPathAbsolute
87-
]
84+
include: [].concat(
85+
this.includedPackages,
86+
[
87+
this.srcPathAbsolute,
88+
this.testPathAbsolute
89+
]
90+
)
8891
}
8992
]
9093
},

0 commit comments

Comments
 (0)