-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
58 lines (53 loc) · 1.4 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';
const path = require('path');
const webpack = require('webpack');
const HappyPack = require('happypack');
const os = require('os');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const createHappyPlugin = function (id, loaders) {
return new HappyPack({
id: id,
loaders: loaders,
threadPool: HappyPack.ThreadPool({size: os.cpus().length }),
cache: true,
verbose: true
});
};
let webpackConfig = {
entry: {
normal: './src/index.js'
},
output: {
path: path.join(__dirname, process.env.BUILD_DEST ||'build'),
filename: '[name].js',
publicPath: '/static/'
},
externals: {},
resolve: {
alias: {
'common': path.join(__dirname, 'src/common/index.scss')
}
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: "happypack/loader?id=js",
exclude: /node_modules/
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style", "css")
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style", 'css!sass')
}
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
createHappyPlugin('js', ['babel']),
]
};
module.exports = webpackConfig;