-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
101 lines (92 loc) · 3.13 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
89
90
91
92
93
94
95
96
97
98
99
100
101
var path = require('path');
var webpack = require('webpack');
// https://www.npmjs.com/package/webpack
// TODO - Maybe this instead of webpack dev server?
//https://babeljs.io/docs/setup/#webstorm
var isDevelopment = (process.env.NODE_ENV !== 'production');
//console.log("IS DEVELOPMENT? " + isDevelopment);
//var entry = isDevelopment ? [
// 'webpack-dev-server/client?http://localhost:8080/',
// 'webpack/hot/dev-server', // Which do we need?
// 'webpack/hot/only-dev-server', // or this?
// './src/entry'
//] : ['./src/entry'];
//var GSC_ITEMS_SERVICE_HOST = isDevelopment ? 'http://catalogs.gospotcheck.com' :
// 'https://someprodurl'; // will need review and such
//var ITEMS_SERVICE_URL = isDevelopment? 'http://items.gospotcheck.com:4000' :
// process.env.ITEMS_SERVICE_BASE_URL;
var pluggins = isDevelopment ? [
new webpack.HotModuleReplacementPlugin()
//new webpack.NoErrorsPlugin()
// new webpack.DefinePlugin({
// ITEMS_SERVICE_URL: JSON.stringify('http://items.gospotcheck.com:4000')
// })
] : [
new webpack.DefinePlugin({
ITEMS_SERVICE_URL: JSON.stringify(process.env.ITEMS_SERVICE_BASE_URL)
})
];
var publicPath = isDevelopment ? 'http://localhost:8080/' : "/";
//console.log("********** CONFIGURE IN webpack.config.js *********");
//console.log("publicPath = " + publicPath);
// https://github.com/gaearon/react-hot-loader/issues/92
//watch: true
//module.exports = {
// entry: {
// index: ['./src/js/index.jsx']
// },
// output: {
// path: path.resolve(__dirname, 'build/js'),
// filename: '[name].js',
// publicPath: 'test/for/'
// },
module.exports = {
// CLI only :(
//devServer: {
// hot: true, inline: true
//},
//devtool: 'eval',
entry: {
src: ['./static/src/entry.js']
},
output: {
path: path.resolve(__dirname, "static"),
publicPath: publicPath,
filename: 'bundle.js'
},
plugins: pluggins,
resolve: {
root: path.resolve('./static/src'),
extensions: ['', '.js', '.jsx', '.js.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/, // /\.jsx?/,
include: [
path.join(__dirname, 'static/src'),
path.join(__dirname, 'static/src/components')
],
loader: 'babel-loader',
// loader: 'react-hot',
// loaders: ['react-hot', 'babel'],
query: {
presets: ['react', 'es2015']
}
},
{
test: /\.css$/,
loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
},
{
test: /\.scss$/,
loader: "style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass"
}
//{ test: /\.scss?$/,
// loader: 'style!css!sass',
// include: path.join(__dirname, 'css') },
//{ test: /\.css$/,
// loader: 'style!css' }
]
}
};