简体   繁体   English

将数据存储在 React 公共文件夹中

[英]Storing data in the React public folder

Currently for demo purposes I have a total of 1GB worth of .mp4/pdf files in my React public folder.目前出于演示目的,我的 React 公共文件夹中总共有 1GB 的 .mp4/pdf 文件。 I reference these files via props (example: file={'/40246/${this.props.showPdf}'} , but eventually these files are going to become larger and I am looking at maybe 50-100GB of .mp4/pdf files in the public folder.我通过道具引用这些文件(例如: file={'/40246/${this.props.showPdf}'} ,但最终这些文件会变得更大,我正在查看 50-100GB 的 .mp4/pdf公用文件夹中的文件。

Is it okay to have such large files in the public folder, will compile time of my app take forever?在公共文件夹中有这么大的文件可以吗,我的应用程序的编译时间会永远花费吗?

I have also researched about ejecting the react app and referencing the files from outside the React src folder, but do not want the hassle of managing or configuring webpacks when something goes wrong.我还研究了如何弹出 React 应用程序并从 React src 文件夹外部引用文件,但不希望出现问题时管理或配置 webpack 的麻烦。 Actually I tried it and my app immediately crashed after npm start实际上我试过了,我的应用程序在 npm start 后立即崩溃了

Any advice or specific documentation I should look into would be appreciated.我应该查看的任何建议或特定文档将不胜感激。

There isn't any process associated for public assets, it just copies the files over to the build folder.没有任何与公共资产相关的进程,它只是将文件复制到build文件夹。 There won't be any impact on performance during the build process.在构建过程中不会对性能产生任何影响。

Demo: check both files( demo.mov ), it just copied the file from public to build with the following command: yarn build prod演示:检查这两个文件( demo.mov ),它只是复制从文件publicbuild用下面的命令: yarn build prod 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM