Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flexibility to the start script #1095

Closed
license2e opened this issue Nov 24, 2016 · 2 comments
Closed

Add flexibility to the start script #1095

license2e opened this issue Nov 24, 2016 · 2 comments
Milestone

Comments

@license2e
Copy link

license2e commented Nov 24, 2016

Description

Instead of just calling openBrowser, allow developers to pass in a script to kick off the start or open functionality. For example, this would be useful for use with electron development.

Proposed behavior

Inside: packages/react-scripts/scripts/start.js

@@ -279,7 +279,15 @@ function runDevServer(host, port, protocol) {
     console.log();

     if (isInteractive) {
-      openBrowser(protocol + '://' + host + ':' + port + '/');
+      var devUrl = protocol + '://' + host + ':' + port + '/';
+      var startScriptPath = require(paths.appPackageJson).startScript || false;
+      if (startScriptPath) {
+        var path = require('path');
+        process.env.DEV_URL = devUrl;
+        require(path.join(process.cwd(), startScriptPath));
+      } else {
+        openBrowser(devUrl);
+      }
     }
   });
 }

Thoughts?

license2e added a commit to license2e/create-react-app that referenced this issue Nov 24, 2016
@gaearon
Copy link
Contributor

gaearon commented Dec 5, 2016

I think #873 (and #1148) should cover this. It's not exactly the same solution but I think we can close this as a duplicate of #873.

@gaearon gaearon closed this as completed Dec 5, 2016
@license2e
Copy link
Author

👍 Thank you!

@gaearon gaearon added this to the 0.9.0 milestone Dec 11, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants