-
Notifications
You must be signed in to change notification settings - Fork 42
Conversation
I think we should get two reviewers on this due to the size and complexity. @Pomax, you have a lot of experience w. server side React rendering, would you mind giving this a review as well? |
module.exports = React.createClass({ | ||
render(){ | ||
return( | ||
<html> |
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.
Can we properly indent this block?
The webpack config files have some crazy indentation going on. Can you fix that? |
When I load http://127.0.0.1:1818/programs/studygroups I get this error on the server:
|
Investigating the error. After un=minifying, it seems to be related to facebook/react#6232
|
Unless I broke something with the deploy process, this should be ready to review again. |
@alicoding this doesn't deploy properly on heroku for some reason, can you take a look? |
Is it working now? |
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
'NODE_ENV': JSON.stringify(`production`) |
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.
Also add this 'PORT': process.env.PORT
because now you are compiling server.jsx
and env
won't be exposed there. Heroku set its own port
and you need to allow that to be exposed to the app.
@alicoding I made those changes but it's still failing. |
@@ -11,7 +11,7 @@ import HTML from './index.jsx'; | |||
|
|||
|
|||
app.listen(process.env.PORT || 1818, function () { |
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.
Change this whole block to this:
var listener = app.listen(process.env.PORT || 1818, function(){
console.log(`Listening on port ${listener.address().port}!`);
});
The problem here is that
|
After removing the server file optimizations (since that file's size doesn't really matter), it looks like webpack is trying to do too much voodoo on the file, causing it to optimize out env vars (at least locally). Investigating what I can do to avoid this now. |
This is now rendering properly, but when landing on https://science-mozilla-org-sta-pr-512.herokuapp.com/projects, a 500 error results. This seems to come from the Debounce component (https://github.com/alanmoo/science.mozilla.org/blob/optimize-webpack/app/react/pages/projects/projects.jsx#L125), it's probably attempting to add an event listener server side. I'm not quite sure how to solve this though. Anyone have ideas? |
This is the error from heroku logs
|
Yeah, I spotted that- it's the debounce component having issues server-side. Investigating how to solve for this other than removing the component or forking it to include a check for its environment. |
I believe I've got this working now. Check out the latest deployment |
Squashed these commits into one based on master, and added a commit to bring in the Google Analytics from #560 |
Closes #406