-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
54 lines (54 loc) · 1.38 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
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const prod = process.env.NODE_ENV === 'production';
const webpack = require('webpack');
module.exports = {
context: `${__dirname}/client`,
entry: [
`${__dirname}/globals`,
`${__dirname}/client/main.js`,
],
output: {
path: `${__dirname}/client/dist`,
filename: 'bundle.js',
publicPath: '/',
},
module: {
loaders: [
{
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.scss$/,
// loaders: ['style', 'css?sourceMap', 'sass?sourceMap'],
loader: ExtractTextPlugin.extract(
'style', // backup loader when not building .css file
!prod ? 'css?sourceMap!autoprefixer-loader!sass?sourceMap' // loaders
: 'css!autoprefixer-loader!sass'
),
},
{
test: /([\w\-\/]+\.(?:eot|woff|ttf|otf|ico|jpeg|png|jpg))/,
loader: 'file-loader?name=[path][name].[ext]',
},
],
},
devServer: {
contentBase: './client',
output: {
filename: 'bundle.js',
publicPath: '/',
},
},
devtool: !prod ? 'source-map' : null,
plugins: [
new ExtractTextPlugin('bundle.css'),
new webpack.ProvidePlugin({
_: 'lodash',
}),
new webpack.DefinePlugin({
__ENV__: JSON.stringify(prod ? 'production' : 'development'),
}),
],
};