File tree Expand file tree Collapse file tree 4 files changed +24
-28
lines changed Expand file tree Collapse file tree 4 files changed +24
-28
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " webpack-typescript-react" ,
3- "version" : " 0.0.5 " ,
3+ "version" : " 0.0.6 " ,
44 "description" : " " ,
55 "license" : " ISC" ,
66 "author" : " " ,
Original file line number Diff line number Diff line change @@ -10,13 +10,15 @@ export const pathRewrite = (localUrl, remoteUrl) => (path) =>
1010
1111export const httpProxyTarget = {
1212 port : 80 ,
13- protocol : 'http: ' ,
13+ protocol : 'http' ,
1414} ;
1515export const httpsProxyTarget = {
1616 port : 443 ,
17- protocol : 'https: ' ,
17+ protocol : 'https' ,
1818} ;
1919
20+ export const devServerHost = isWindows ( ) ? '127.0.0.1' : '0.0.0.0' ;
21+
2022export 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' ;
41/**
52 * Created by: Andrey Polyakov (andrey@polyakov.im)
63 */
4+ import path from 'path' ;
5+
6+ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin' ;
77import HtmlWebpackPlugin from 'html-webpack-plugin' ;
88
9- import { defaultPort as port } from './constants/devproxy' ;
9+ import { devServerHost , defaultPort as port } from './constants/devproxy' ;
1010import devProxyConfig from './resources/devProxy' ;
1111
1212export default {
1313 devtool : '#cheap-module-source-map' ,
14- stats : false ,
1514 plugins : [
1615 new HtmlWebpackPlugin ( {
1716 filename : 'index.html' ,
@@ -28,5 +27,6 @@ export default {
2827 proxy : devProxyConfig ,
2928 hot : true ,
3029 overlay : false ,
30+ host : devServerHost ,
3131 } ,
3232} ;
Original file line number Diff line number Diff line change 44import { httpsProxyTarget , pathRewrite } from '../constants/devproxy' ;
55
66export 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+ } ,
2519} ;
You can’t perform that action at this time.
0 commit comments