-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (55 loc) · 1.5 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
const path = require('path');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const ASSET_PATH = process.env.ASSET_PATH || 'http://localhost:8888/';
module.exports = {
context: __dirname,
entry: './quickdraw/front/javascripts/index.js',
output: {
path: path.resolve(__dirname, 'quickdraw/static/'),
filename: 'bundle.js',
publicPath: ASSET_PATH,
},
resolve: {
extensions: ['.js', '.jsx'],
modules: [
path.resolve(__dirname, 'quickdraw/front/javascripts'),
'node_modules',
],
},
devServer: {
port: 8888,
contentBase: path.resolve(__dirname, 'quickdraw/static'),
headers: {
'Access-Control-Allow-Origin': 'http://localhost:8080',
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Headers':
'Content-Type, Authorization, x-id, Content-Length, X-Requested-With',
'Access-Control-Allow-Methods': 'GET, POST, PUT, PATCH, DELETE, OPTIONS',
},
https: false,
disableHostCheck: true,
},
plugins: [
new BundleTracker({ filename: './webpack-stats.json' }),
new webpack.DefinePlugin({
'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH),
}),
],
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [['env', { modules: false }], 'react'],
},
},
],
exclude: /node_modules/,
},
],
},
};