-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.dev.js
76 lines (75 loc) · 2.46 KB
/
webpack.config.dev.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
const path = require("path");
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const env = require('dotenv').config();
module.exports = {
devtool: 'cheap-module-eval-source-map',
context: __dirname,
entry: './client/index.js',
target: 'web',
output: {
path: path.join(__dirname, './static/'),
filename: 'js/[name].js',
publicPath: 'http://0.0.0.0:9000/',
},
plugins: [
new webpack.DefinePlugin({
'process': {
'env': {
'G_SUITE_DOMAIN': JSON.stringify(process.env.G_SUITE_DOMAIN),
'CLIENT_ID': JSON.stringify(process.env.CLIENT_ID)
}
}
}),
new BundleTracker({filename: './webpack-stats.json'}),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.LoaderOptionsPlugin({
debug: true
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
],
module: {
loaders: [
{ test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015', 'react'] } },
{ test: /(\.css|scss)$/, loaders: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.(jpeg|png|gif|svg|jpg)$/, loader: 'url-loader?limit=25000' },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader' },
{ test: /\.(woff|woff2)$/, loader: 'url?prefix=font/&limit=5000' },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream' },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml' }
],
},
devServer: {
host: "0.0.0.0",
publicPath: 'http://0.0.0.0:9000/',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Content-Type, Authorization, accept, accept-encoding, authorization, dnt, origin, user-agent, x-csrftoken, x-requested-with',
},
compress: true,
port: 9000,
proxy: {
'/api/v1': {
target: 'http://0.0.0.0:8000',
secure: false,
}
},
clientLogLevel: 'none',
hot: true,
inline: true,
historyApiFallback: true,
watchOptions: {
ignored: /node_modules/
}
},
resolve: {
modules: ['node_modules', 'bower_components'],
extensions: ['.js', '.jsx']
},
node: {
fs: 'empty',
},
}