reactjs - 在heroku中部署Web应用程序时出现应用程序错误
问题描述
我一直在尝试将我的网络应用程序部署到 heroku,但无论我做什么都会说应用程序错误。这是我的项目结构
myApp
|_ .vscode
|_ node_modules
|_ package.json
|_ Procfile
|_ .babelrc
|_ webpack.config.js
|_ src
|_ static
|_ app.js
|_ experiment.js
|_ index.js
|_ timeline.js
|_ index.html
我的 package.json 看起来像这样
{
"name": "webpackreact",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack serve --mode development --open --hot",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jspsych-react": "github:openexp/jspsych-react#v0.4.0",
"jspsych-react-cra": "git+https://git@github.com/neurotype/jspsych-react-cra.git",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.14.5",
"babel-core": "^6.26.3",
"babel-loader": "^8.2.2",
"html-webpack-plugin": "^5.3.2",
"webpack": "^5.50.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2"
}
}
我有 procfile 作为
web:node node_modules/webpack-dev-server/bin/webpack-dev-server.js
这是我的 webpack.config.js 文件
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, '/dist'),
filename: 'index_bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
})
]
}
这是来自 heroku logs --tail -a myappname 的日志
谢谢
解决方案
推荐阅读
- python-3.x - 带有 Python 集成包问题的 TABPY 画面
- c# - c#visual studio - 发布项目后查找图片的绝对路径
- sql - 如何将两个 CSV(单独的标题和内容)添加到 SQL Server?
- java - RestAssured - 解析响应时 get() 和 getString() 有什么区别?
- angular - localStorage 没有分配键,而是键具有值数据
- visual-studio-code - 未找到 Angular Live Development Server api 请求
- r - 多元状态空间模型 dlm okuns 定律
- ios - Objective-C 中的块是否总是保证捕获变量?
- entity-framework - 实体框架:从自定义 DbContext 继承
- anylogic - 如何设计多级公路交叉口