-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
45 lines (42 loc) · 1.03 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
var config = {
context: __dirname + '/src', // `__dirname` is root of project and `src` is source
entry: {
app: './app.js',
},
output: {
path: __dirname,
filename: "./dist/bundle.js"
},
module: {
rules: [
{
test: /\.(sass|scss|css)$/, //Check for sass or scss file names
use: [
'style-loader',
'css-loader',
'sass-loader',
]
},
{
test: /\.js$/, //Check for all js files
loader: 'babel-loader',
query: {
presets: [ "babel-preset-es2015" ].map(require.resolve)
}
},
]
},
devServer: {
contentBase: __dirname + '/public',
proxy: {
"/api": "http://localhost:5000",
"/ws": { target: "ws://localhost:5000", ws: true }
},
},
devtool: "eval-source-map", // Default development sourcemap
};
// Check if build is running in production mode, then change the sourcemap type
if (process.env.NODE_ENV === "production") {
config.devtool = "source-map";
}
module.exports = config;