Answer the question
In order to leave comments, you need to log in
How to pass server-side-rendering, react, redux through webpack?
I can't figure out how to pass the server side through webpack.
https://github.com/kherel/server_rendering
at the moment, server part without webpack but using babel and ignoring styles
require('babel-core/register');
['.css', '.less', '.sass', '.ttf', '.woff', '.woff2'].forEach((ext) => require.extensions[ext] = () => {});
require('babel-polyfill');
require('server.js');
..
const componentHTML = ReactDom.renderToString(
<Provider store={store}>
<RouterContext {...renderProps} />
</Provider>
);
resolve: {root: [..]}
, which makes it possible to opt out of relative paths in the project. loaders: ["style", "css?modules&importLoaders=1&localIdentName=[path]-[local]&context=src", "sass"],
as well as the catnip library ( https://github.com/alextewpin/catnip), in most components I do something like this:import catnip from 'catnip';
import styles from './styles.scss';
const cn = catnip(styles)
const ScssComponent = ({color, children}) =>
<div className={cn({color})}>{children}</div>
import serverEntry from '../static/bundle.server.js'
..
ReactDom.renderToString(serverEntry(store, renderProps))
Answer the question
In order to leave comments, you need to log in
Instead of ExtractTextPlugin use isomorphic-style-loader, example:
{ test: /\.(sass|scss)$/, use: [
{ loader: "isomorphic-style-loader" },
{ loader: "css-loader", options: { modules: true }},
{ loader: "postcss-loader" },
{ loader: "sass-loader" }
]}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question