forked from gocodeup/movies-application-DEPRECATED
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
51 lines (47 loc) · 1.18 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
// for resolving the absolute path to our project
// necessary for webpack
const path = require('path');
const webpack = require('webpack');
module.exports = {
// where our app "starts"
// add the promise and fetch polyfill first
entry: ['promise-polyfill', 'whatwg-fetch', './src/index.js'],
// where to put the transpiled javascript
output: {
path: path.resolve(__dirname, 'public'),
filename: 'main.js'
},
// babel config
module: {
rules: [
{
// any file that ends with '.js'
test: /\.js$/,
// except those in "node_modules"
exclude: /node_modules/,
// transform with babel
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
},
// allows us to see how the transpiled js relates to the untranspiled js
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, 'public'),
port: 1313,
compress: true,
watchContentBase: true,
// send requests that start with "/api" to our api server
proxy: {
'/api': {
target: 'http://localhost:3000',
pathRewrite: {'^/api': ''}
}
}
}
};