-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
88 lines (83 loc) · 2.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var path = require('path');
var srcPath = path.join(__dirname, 'src');
var buildPath = path.join(__dirname, 'build', 'public');
var webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
config = {
context: srcPath,
entry: path.join(srcPath, 'client', 'client.js'),
devtool: 'eval-cheap-module-source-map',
output: {
path: buildPath,
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
/* query: {
presets: ['react', 'es2015','stage-0']
}*/
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css')
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]')
}
/* {
test: /(\.scss|\.css)$/,
loaders: ["style", "css?modules", "sass"]
}*/
]
},
plugins: [new ExtractTextPlugin('styles.css')],
resolve: {
root: __dirname
}
};
const serverConfig={
name: 'server',
target: 'node',
devtool: 'eval-cheap-module-source-map',
externals: [nodeExternals()],
entry: [
path.join(srcPath, 'server', 'server.js'),
],
output: {
path: path.join(__dirname, 'build'),
filename: 'server.js',
publicPath: 'build/',
libraryTarget: 'commonjs2'
},
node: {
__dirname: false,
__filename: false,
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.css$/,
loader: 'null'
},
{
test: /\.scss$/,
loader: 'css-loader/locals?modules&importLoaders=1&localIdentName=[name]__[local]'
}
]
},
resolve: {
root: __dirname
}
};
module.exports = [config, serverConfig];