Socket
Socket
Sign inDemoInstall

react-app-rewire-build-dev

Package Overview
Dependencies
13
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

server/build/index.html

8

dist/write-file.js

@@ -43,3 +43,4 @@ "use strict";

useHashIndex: true,
outputPath: "/"
outputPath: "/",
hotReloadPort: "3000"
}, userOptions);

@@ -171,2 +172,7 @@

}
if (outputFilePath.indexOf("bundle.js") !== -1) {
assetSource = assetSource.replace(/window.location.port/g, options.hotReloadPort);
}
fs.writeFileSync(relativeOutputPath.split("?")[0], assetSource);

@@ -173,0 +179,0 @@ log(targetDefinition, chalk.green("[written]"), chalk.magenta("(" + filesize(assetSize) + ")"));

8

package.json
{
"name": "react-app-rewire-build-dev",
"version": "1.0.0",
"version": "1.0.1",
"description": "Source code files used by `webpack-dev-server` is rendered in watch mode at user specified directory through override create-react-app webpack configs without ejecting",

@@ -33,8 +33,6 @@ "main": "./dist/index.js",

"scripts": {
"lint": "eslint ./src",
"build": "babel --source-maps --copy-files ./src --out-dir ./dist",
"prepare": "babel --source-maps --copy-files ./src --out-dir ./dist",
"test": "echo 'Please add tests :-('",
"readme": "gitdown ./.README/README.md --output-file ./README.md",
"prepublish": "npm run build"
"prepublish": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},

@@ -41,0 +39,0 @@ "devDependencies": {

@@ -5,5 +5,15 @@ # react-app-rewire-build-dev

Source code files used by `webpack-dev-server` is rendered in watch mode at user specified directory through override create-react-app webpack configs without ejecting.
Source code files used by `webpack-dev-server` is rendered in watch mode at user specified directory without ejecting create-react-app.
# Why do I need this?
As of now (21/06/2018), `create-react-app` (more precisely `react-scripts`) does not allow development builds to be written to the disk because it uses `webpackDevServer` to serve your build files and folders ([for good reasons](https://github.com/facebook/create-react-app/issues/1070#issuecomment-261812303)). The problem is that in some cases you need to have these files written to the disk i.e:
* Developing browser extensions using React.
* Incorporating your React application into an existing application.
* Serving your React app with a dedicated backend.
## Installation

@@ -33,2 +43,3 @@

basename : "<location of subdirectory>" // deploy react-app in a subdirectory /***** optional *****/
hotReloadPort : "<port of webpack-server>" // default:3000,simply relaod the webpage on changes./***** optional *****/
}

@@ -35,0 +46,0 @@

@@ -38,3 +38,4 @@ const fs = require("fs");

useHashIndex: true,
outputPath: "/"
outputPath: "/",
hotReloadPort : "3000"
},

@@ -200,6 +201,3 @@ userOptions

try {
if (
options.basename &&
outputFilePath.indexOf("index.html") !== -1
) {
if (options.basename && outputFilePath.indexOf("index.html") !== -1) {
assetSource = assetSource

@@ -211,2 +209,7 @@ .replace(/href="/g, `href="${options.basename}`)

}
if (outputFilePath.indexOf("bundle.js") !== -1) {
assetSource = assetSource.replace(/window.location.port/g, options.hotReloadPort );
}
fs.writeFileSync(relativeOutputPath.split("?")[0], assetSource);

@@ -213,0 +216,0 @@ log(

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc