File tree Expand file tree Collapse file tree 4 files changed +24
-28
lines changed
Filter options
Expand file tree Collapse file tree 4 files changed +24
-28
lines changed
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " webpack-typescript-react" ,
3
- "version" : " 0.0.5 " ,
3
+ "version" : " 0.0.6 " ,
4
4
"description" : " " ,
5
5
"license" : " ISC" ,
6
6
"author" : " " ,
Original file line number Diff line number Diff line change @@ -10,13 +10,15 @@ export const pathRewrite = (localUrl, remoteUrl) => (path) =>
10
10
11
11
export const httpProxyTarget = {
12
12
port : 80 ,
13
- protocol : 'http: ' ,
13
+ protocol : 'http' ,
14
14
} ;
15
15
export const httpsProxyTarget = {
16
16
port : 443 ,
17
- protocol : 'https: ' ,
17
+ protocol : 'https' ,
18
18
} ;
19
19
20
+ export const devServerHost = isWindows ( ) ? '127.0.0.1' : '0.0.0.0' ;
21
+
20
22
export const devServerUrl = isWindows ( )
21
- ? `http://127.0.0.1 :${ defaultPort } /`
22
- : `http://0.0.0.0 :${ defaultPort } /` ;
23
+ ? `http://${ devServerHost } :${ defaultPort } /`
24
+ : `http://${ devServerHost } :${ defaultPort } /` ;
Original file line number Diff line number Diff line change 1
- import path from 'path' ;
2
-
3
- import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin' ;
4
1
/**
5
2
* Created by: Andrey Polyakov (andrey@polyakov.im)
6
3
*/
4
+ import path from 'path' ;
5
+
6
+ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin' ;
7
7
import HtmlWebpackPlugin from 'html-webpack-plugin' ;
8
8
9
- import { defaultPort as port } from './constants/devproxy' ;
9
+ import { devServerHost , defaultPort as port } from './constants/devproxy' ;
10
10
import devProxyConfig from './resources/devProxy' ;
11
11
12
12
export default {
13
13
devtool : '#cheap-module-source-map' ,
14
- stats : false ,
15
14
plugins : [
16
15
new HtmlWebpackPlugin ( {
17
16
filename : 'index.html' ,
@@ -28,5 +27,6 @@ export default {
28
27
proxy : devProxyConfig ,
29
28
hot : true ,
30
29
overlay : false ,
30
+ host : devServerHost ,
31
31
} ,
32
32
} ;
Original file line number Diff line number Diff line change 4
4
import { httpsProxyTarget , pathRewrite } from '../constants/devproxy' ;
5
5
6
6
export default {
7
- // '/world-time': {
8
- // target: {
9
- // host: 'worldtimeapi.org',
10
- // ...httpsProxyTarget
11
- // },
12
- // pathRewrite: pathRewrite('^/world-time/test', '/api'),
13
- // changeOrigin: true,
14
- // secure: false,
15
- // },
16
- // '/someurl/test': {
17
- // target: {
18
- // host: 'reqres.in',
19
- // ...httpsProxyTarget
20
- // },
21
- // pathRewrite: pathRewrite('^/someurl/test', '/api'),
22
- // changeOrigin: true,
23
- // secure: false,
24
- // }
7
+ '/world-time' : {
8
+ target : `${ httpsProxyTarget . protocol } ://worldtimeapi.org:${ httpsProxyTarget . port } ` ,
9
+ pathRewrite : pathRewrite ( '^/world-time/test' , '/api' ) ,
10
+ changeOrigin : true ,
11
+ secure : false ,
12
+ } ,
13
+ '/someurl/test' : {
14
+ target : `${ httpsProxyTarget . protocol } ://reqres.in:${ httpsProxyTarget . port } ` ,
15
+ pathRewrite : pathRewrite ( '^/someurl/test' , '/api' ) ,
16
+ changeOrigin : true ,
17
+ secure : false ,
18
+ } ,
25
19
} ;
You can’t perform that action at this time.
0 commit comments