我正在使用
"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”中解析包。
感谢您的帮助。