【发布时间】:2020-12-02 11:28:58
【问题描述】:
我正在尝试使用 express.static 中间件为生产构建反应应用程序提供服务,但总是得到一个空白页面。经过调查,我注意到由于某种原因,bundle.js 内容实际上是 html。中间件和配置如下。
app.use(express.static(path.join(__dirname, 'client/dist')));
app.get('*', (req, res) =>
res.sendFile(path.join(__dirname, '/client/dist/index.html'))
);
【问题讨论】:
-
你能把你的 webpack 配置也放上来吗?
-
@AravindaMeewalaarachchi,我已经设法解决了,非常感谢您的回复。
标签: node.js reactjs express webpack