You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My use case here is that in dev mode I'd like to be able to run:
var openBrowser = require('react-dev-utils/openBrowser')
if (openBrowser('http://localhost:3000')) {
console.log('The browser tab has been opened!');
}
after the server has created the manifest.
Essentially I'm looking for some sort of lifecycle hooks or events to run code before or after.
The text was updated successfully, but these errors were encountered:
Whoaa512
changed the title
No way to run code on server start
Server lifecycle events?
Mar 22, 2019
I think the only way to do this is by using zero from it's API. It returns a promise after which you can do additional stuff.
This example will run zero in ./www/ directory:
constpath=require("path");conststartServer=require("zero").server;constopenBrowser=require('react-dev-utils/openBrowser');startServer(path.join(__dirname,"./www")).then(()=>{if(openBrowser('http://localhost:3000')){console.log('The browser tab has been opened!');}})
My use case here is that in dev mode I'd like to be able to run:
after the server has created the manifest.
Essentially I'm looking for some sort of lifecycle hooks or events to run code before or after.
The text was updated successfully, but these errors were encountered: