reactjs - Set .htpasswd .htaccess for React build directory
问题描述
I am using apache to host the ReactProject
I put .htpasswd
and .htaccess
in ReactProject/build
directory, it works.
However once I did npm run build
again.
Both files were deleted.
How can I prevent this??
解决方案
您可以将它们放在公共文件夹中!
文件被删除的原因是每当你 npm run build 时,公共文件夹移动到 build 文件夹。它只是意味着如果你执行 npm run build,build 文件夹是由 public 文件夹创建的。
推荐阅读
- maven - CassandraUnit 在启动过程中遇到异常
- flutter - 在不使用互联网的情况下,在同一个 wifi 上的移动设备之间共享数据
- c# - 如何在 ASP.NET MVC 中使用隐藏的 csrf-token 登录
- word2vec - word2vec:针对低频词进行优化
- android - 如何在 android 中使用 Glide 加载静态图像
- sql - 来自一个嵌套 SELECT 的多个 SELECT
- swiftui - 带有 UITextContentType emailAddress 的 TextField 的行为不像电子邮件文本字段
- phpmailer - WHM / EXIM / SES - SMTP 错误“我们未授权使用此系统传输未经请求的 220 和/或批量电子邮件”
- c# - Angular 12 - Decimal.Parse 不返回带有点/点/句点的小数
- c++ - 如何编写从 std::invalid_argument 派生的自定义异常类?