问题描述
我正在尝试将github repo LargeGroupVideoChat-Web-Webpack推送到Heroku。 在本地工作正常,使用以下脚本在package.json文件中:
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --config ./scripts --mode development","build": "cross-env NODE_ENV=production webpack --config ./scripts --mode production"},
以及index.js文件中的webpack设置:
module.exports = {
entry: {
index: "./src/index.js",},devtool: "inline-source-map",module: loaders,plugins,resolve: {
extensions: [ ".js" ],output: {
filename: "[name].[hash].js",path: path.resolve(__dirname,distPath),...
但是,在推送到Heroku之后,它崩溃并显示错误。我用以下代码添加了server.js文件:
const express = require('express');
const path = require('path');
const port = process.env.PORT || 8080;
const app = express();
// the __dirname is the current directory from where the script is running
app.use(express.static(__dirname));
// send the user to index html page inspite of the url
app.get('*',(req,res) => {
res.sendFile(path.resolve(__dirname,'index.html'));
});
app.listen(port);
运行正常,但仅提供index.html文件,并且未捆绑webpack捆绑包。是否有将应用程序推送到Heroku的快速方法?还是我必须以某种方式重写Webpack设置?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)