catamphetamine / universal-webpack

Isomorphic Webpack: both on client and server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Production question

ziad-saab opened this issue · comments

Hello @halt-hammerzeit,

Thanks for universal-webpack, it's been working great for me in development.

For production usage, it seems that you're running your server through import {server} from 'universal-webpack', same as in dev.

In my case, I'd like to avoid if possible running my production server through an extra layer, if possible.

The solution I'm using at the moment is a start-prod-server.js script. It does the following:

var server = require('./build/server/server').default;
var chunks = require('./build/assets/webpack-chunks.json');
server({chunks: () => chunks});

It seems to be working well at the moment. Do you see anything wrong with this?

I'd like to avoid if possible running my production server through an extra layer

What do you mean by that?

I don't see any difference between running server-side code in production compared to development.
If you have any differences between production and development modes on the server side you can explain them here.

You're right, there is no difference between development and production. I simply want to avoid the dependency on universal-webpack in production if possible.

I'm looking at source/server.js and it seems that's pretty much what you are doing anyway -- chunks is a function that returns the content of the webpack-chunks.json file.

I'm only asking if you think I'm missing anything by having my own server-starter for prod.

Ok, then you aren't missing anything.
You can use your own runner for the server side if you want.

Thanks for the fast answer :)