私は使っている
"webpack": "^2.4.1",
"webpack-dev-middleware": "^1.10.2",
"react-hot-loader": "next",
"webpack-hot-middleware": "^2.18.0",
ここにwebpackクライアント構成エントリがあります
entry: {
main: [
'react-hot-loader/patch',
'webpack-hot-middleware/client',
'./client.js',
],
vendor,
}、
ここにserver/index.jsがあります
import webpackConfig from '../webpack/webpack.config.client';
const app = express();
const compiler = webpack(webpackConfig);
app.use(webpackDev(compiler, {
noInfo: true,
publicPath: webpackConfig.output.publicPath,
serverSideRender: true,
}));
app.use(webpackHot(compiler));
今、サーバーを実行しているときnpm run build:dev && babel-node -- dist/SSR.js
このエラーが発生しています。
ERROR in multi react-hot-loader/patch webpack-hot-middleware/client ./client.js
Module not found: Error: Can't resolve './client.js' in '/app'
@ multi react-hot-loader/patch webpack-hot-middleware/client ./client.js
ERROR in multi react react-dom redux react-redux react-router-dom react-helmet axios
Module not found: Error: Can't resolve 'react' in '/app'
@ multi react react-dom redux react-redux react-router-dom react-helmet axios
ERROR in multi react react-dom redux react-redux react-router-dom react-helmet axios
Module not found: Error: Can't resolve 'react-dom' in '/app'
@ multi react react-dom redux react-redux react-router-dom react-helmet axios
ERROR in multi react react-dom redux react-redux react-router-dom react-helmet axios
Module not found: Error: Can't resolve 'redux' in '/app'
@ multi react react-dom redux react-redux react-router-dom react-helmet axios
Webpack Dev ミドルウェアが「/app」のみでパッケージを解決しようとする理由。
手伝ってくれてありがとう。