我正在构建的React App具有manifest.json和env.json如下,
但是,当我使用AWS-Amplify将网站发布到S3存储桶时,manifest.json和env.json会加载我的index.html。一切都在localhost中正常运行,但在生产中,即使我们可以将其他文件作为图标和robot.txt获取,也遇到了前一个问题。
下一个是我们公用文件夹的内容:
asset-manifest.json
browserconfig.xml
ec4c4f981671b5dee24ab5f541f07720.png
ef7c6637c68f269a882e73bcb57a7f6a.woff2
env.json <----- loading index.html
icons
index.html
main-5fbcf0b95e5bf6891f54.js
main-5fbcf0b95e5bf6891f54.js.LICENSE.txt
manifest.json. <----- loading index.html
robots.txt. <------ working
service-worker.js
amplify.yml文件如下所示:
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- NODE_ENV=$MY_ENV_SELECTOR node ./node_modules/webpack/bin/webpack.js --mode production --env=prod
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
看起来它正在为我们提供index.html,因为它没有找到所请求的文件,但是我们不知道为什么会发生这种情况。
我们希望任何人都可以帮助我们解决这个问题。
我发现了问题。
基本上,Amplify具有重定向功能,我们需要配置该功能来提供此文件。
谢谢大家!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句