-
Notifications
You must be signed in to change notification settings - Fork 184
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 compileOnStartup Option #869
Add compileOnStartup Option #869
Conversation
…ensure the server uses that code without recompiling it each time the server starts.
…ause it mocks the compile.run function so that it applies more uniformly to each of the JS servers. Also, fixed an issue where the run command wasn't returning a promise when starting the server, instead it was returning an object with the started promise inside it.
…Add initial documentation for compileOnStartup option.
…run script to the cli script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Short, sweet, and to the point.
cb(null, null); | ||
}; | ||
} else { | ||
({serverRoutes, compiler} = compileClient(options)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I find the parentheses around this expression make it harder to parse visually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too. Here's the issue I have: I defined serverRoutes
and compiler
previously using let
. ES6 destructuring only works like this:
let {a, b} = stuff;
const {c, d} = stuff;
let e, f;
({e, f} = stuff);
This is a syntax error: {a, b} = stuff;
. I could put a comment above that line so that it's clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, TIL.
@@ -157,7 +157,8 @@ export default (server, reactServerMiddleware) => { | |||
server.use(compression()); | |||
server.use(bodyParser.urlencoded({ extended: false })); | |||
server.use(bodyParser.json()); | |||
server.use(session(options)); | |||
server.use(helmet()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this adding helmet here now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read through the documentation to update it with compileOnStartup
stuff and noticed that the custom express middleware example wasn't updated previously. I can remove it if it's an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, somehow I thought we were adding it automatically now. Makes sense. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well...we are because of #812, but we missed updating this example to depict the new default express middleware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, and users are responsible for adding it themselves if they override the default with custom middleware.
Nice catch.
Addresses #868. Tests and documentation have been updated as well. Also, fixes #801 by removing references to the old
compileOnly
option from source code and documentation. Lastly, fixes a minor issue with the Promise chain within the cli script.