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
webpacking the server for production #48
Comments
+1 for compiling the server... |
@dustinsanders sure it is. If you can submit a PR that would be great. |
@Ajar-Ajar here is the right link. |
IMHO we should have a different webpack config file for server-side, which builds a '/build/server.build.js'. Is there a better way to do this? |
@dustinsanders - thank you for the link, nice trick with the if-env script in the package.json to create a unified npm start rutine... the only thing I'm missing in this setup is that the server doesn't use es6 features like import that require a babel compilation. and suppose we do need to compile it, we will probably need to modify the folder structure to use both client and server under the dist folder... |
@Ajar-Ajar I haven't done it before but that is what this link is suggesting. |
If we are webpacking the server, css-modules-require-hook is not working. We have to figure out another way to inject css modules class names in the rendered html. After that, we can keep enable server webpacking again. |
👍 |
This react-router tutorial use this approach to get externals: // keep node_module paths out of the bundle
externals: fs.readdirSync(path.resolve(__dirname, 'node_modules')).concat([
'react-dom/server', 'react/addons',
]).reduce(function (ext, mod) {
ext[mod] = 'commonjs ' + mod
return ext
}, {}), I've used it and got lots of problems (mostly with babel-polyfill). The solution was simply using Morhaus/webpack-externals-plugin. I just wanted to share with you my experience. Hope this plugin could be helpful to v2. |
Is there any interest in using webpack on the server for production, as outlined here. If there is interest, I can submit a pull request.
The text was updated successfully, but these errors were encountered: