-
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathwebpack.config.js
More file actions
39 lines (37 loc) · 924 Bytes
/
webpack.config.js
File metadata and controls
39 lines (37 loc) · 924 Bytes
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const apiMocker = require('mocker-api');
module.exports = {
entry: {
app: './src/index.js',
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
devServer: {
port: 8082,
onBeforeSetupMiddleware: (devServer) => {
apiMocker(devServer.app, path.resolve('./mocker/index.js'), {
proxy: {
'/repos/(.*)': 'https://api.github.com/',
},
changeHost: true,
})
},
// before(app){
// apiMocker(app, path.resolve('./mocker/index.js'), {
// proxy: {
// '/repos/(.*)': 'https://api.github.com/',
// },
// changeHost: true,
// })
// }
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve('./public/index.html'),
title: 'Webpack App Mocker API'
})
],
};