gh页面只发布背景图像



我是gh页面的新手,今天部署了我的第一个站点。但是,仅显示背景图像:https://sabago.github.io/sabago-portfolio/

我的回购:https://github.com/sabago/sabago-portfolio

在谷歌上搜索时,我发现:将react应用程序上传到gh页面后,只显示背景。但那不是我的问题。

localhost上一切正常。

非常感谢您的帮助。

注意:我应该补充一点,我在控制台上看到一个错误。我不确定它是否相关,但它指向tsconfig(esnext(中的编译器模块。

main.9af833d9.chunk.js:1 Uncaught ReferenceError: exports is not defined
at Module.21 (main.9af833d9.chunk.js:1)
at a ((index):1)
at Object.12 (App.tsx:4)
at a ((index):1)
at Module.44 (main.9af833d9.chunk.js:1)
at a ((index):1)
at Object.14 (main.9af833d9.chunk.js:1)
at a ((index):1)
at t ((index):1)
at Array.r [as push] ((index):1)

我的tsconfig

"compilerOptions": {
"target": "es6",
"module": "esnext",
"sourceMap": true,
"jsx": "react",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
},
"include": [
"src"
]
}

package.JSON

{
"homepage": "https://sabago.github.io/sabago-portfolio/",
"name": "sabago",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^25.2.1",
"@types/node": "^13.13.5",
"@types/react": "^16.9.34",
"@types/react-burger-menu": "^2.6.1",
"@types/react-dom": "^16.9.7",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"typescript": "^3.8.3",
"webpack-cli": "^3.3.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages master -d build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^2.2.0",
"webpack-cli": "^3.3.11"
}
}

您已经安装了gh-pages包,因此要部署应用程序,您只需从应用程序目录中的命令行运行以下命令:

yarn deploy

这将把您的build目录推送到github页面。如果你还没有建立你的应用程序,你需要先建立它:

yarn build && yarn deploy

我不确定实际的解决方案是什么。我通过重新启动来修复它,但这次我在创建react应用程序后部署,然后再进行编码。

最新更新