Skip to content

Commit ec48d43

Browse files
committed
Style tweaks
1 parent 23496c1 commit ec48d43

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

webpack.config.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
var path = require('path');
21
var fs = require('fs');
2+
var path = require('path');
33
var webpack = require('webpack');
44

5+
var EXAMPLES_DIR = path.resolve(__dirname, 'examples');
6+
7+
function isDirectory(dir) {
8+
return fs.lstatSync(dir).isDirectory();
9+
}
10+
11+
function buildEntries() {
12+
return fs.readdirSync(EXAMPLES_DIR).reduce(function(entries, dir) {
13+
if (dir === 'build')
14+
return entries;
15+
16+
var isDraft = dir.charAt(0) === '_';
17+
18+
if (!isDraft && isDirectory(path.join(EXAMPLES_DIR, dir)))
19+
entries[dir] = path.join(EXAMPLES_DIR, dir, 'app.js');
20+
21+
return entries;
22+
}, {});
23+
}
24+
525
module.exports = {
26+
627
entry: buildEntries(),
728

829
output: {
@@ -14,7 +35,7 @@ module.exports = {
1435

1536
module: {
1637
loaders: [
17-
{test: /\.js$/, loader: 'jsx-loader'}
38+
{ test: /\.js$/, loader: 'jsx-loader' }
1839
]
1940
},
2041

@@ -24,22 +45,8 @@ module.exports = {
2445
}
2546
},
2647

27-
plugins: [new webpack.optimize.CommonsChunkPlugin('shared.js')]
48+
plugins: [
49+
new webpack.optimize.CommonsChunkPlugin('shared.js')
50+
]
2851

2952
};
30-
31-
32-
function buildEntries() {
33-
return fs.readdirSync('examples').reduce(function(entries, dir) {
34-
if (dir === 'build')
35-
return entries;
36-
37-
var isDraft = dir.charAt(0) === '_';
38-
39-
if (!isDraft && fs.lstatSync(path.join('examples', dir)).isDirectory())
40-
entries[dir] = './examples/'+dir+'/'+'app.js';
41-
42-
return entries;
43-
}, {});
44-
}
45-

0 commit comments

Comments
 (0)