Created
February 6, 2019 11:07
Revisions
-
timonweb revised this gist
Feb 6, 2019 . 1 changed file with 15 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,11 @@ const pathClient = "./node_modules/react-dev-utils/webpackHotDevClient.js"; fs.writeFileSync( pathClient, fs .readFileSync(pathClient) .toString() .replace( `var connection = new SockJS( url.format({ protocol: window.location.protocol, hostname: window.location.hostname, @@ -14,11 +17,10 @@ fs.writeFileSync( pathname: '/sockjs-node', }) );`, ` var scriptUrl = document.currentScript ? url.parse(document.currentScript.src) : window.location; var connection = new SockJS( url.format({ protocol: scriptUrl.protocol, @@ -28,17 +30,17 @@ var connection = new SockJS( pathname: '/sockjs-node', }) );` ) ); const pathConfig = "./node_modules/react-scripts/config/webpackDevServer.config.js"; fs.writeFileSync( pathConfig, fs .readFileSync(pathConfig) .toString() .replace( `const publicPath = '/';`, `const publicPath = process.env.PUBLIC_PATH || '/';` ) ); -
madebyherzblut created this gist
Aug 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ const fs = require("fs"); const pathClient = "./node_modules/react-dev-utils/webpackHotDevClient.js"; fs.writeFileSync( pathClient, fs.readFileSync(pathClient).toString().replace( `var connection = new SockJS( url.format({ protocol: window.location.protocol, hostname: window.location.hostname, port: window.location.port, // Hardcoded in WebpackDevServer pathname: '/sockjs-node', }) );`, ` var scriptUrl = document.currentScript ? url.parse(document.currentScript.src) : window.location; var connection = new SockJS( url.format({ protocol: scriptUrl.protocol, hostname: scriptUrl.hostname, port: scriptUrl.port, // Hardcoded in WebpackDevServer pathname: '/sockjs-node', }) );` ) ); // NOTE: I am using the "react-script-ts" fork const pathConfig = "./node_modules/react-scripts-ts/config/webpack.config.dev.js"; fs.writeFileSync( pathConfig, fs.readFileSync(pathConfig).toString().replace( `const publicPath = '/';`, `const publicPath = process.env.PUBLIC_PATH || '/';` ) );