reactjs - Generating index.js files exporting all (thousands) components
问题描述
when looking into libraries such as material-ui, it becomes quite clear that there's some sort of script which takes care of exporting thousands of components at the same time from an index.js file.
If we look e.g. here, I can only assume that this file wasn't generated by a person (8k+ exports).
Before I reinvent the wheel, is there some standard library that one uses to create those export files? Or does rollup or some other bundler create them on the fly?
解决方案
This shell should do the work
for f in *.js; do
echo "export { default as $f } from './$f'"
done
Redirect the output to a file and that's it
推荐阅读
- google-directions-api - Directions API - 有中途停留的目的地
- r - 如何使用 R 读取文件夹中的所有 hdf 文件?
- asp.net-mvc - 根据第一个 Droplist 的值填充第二个 Droplist
- java - 延迟的 Springboot 事件发布者
- android - 如何以编程方式在 Android Q 中打开设置面板?
- java - java中的oracle查询性能
- javascript - 不允许在 JavaScript 中的 eyeIcon 上显示保存的密码
- java - Selenium 3.141.59 在 Eclipse 上不能与 JDK 12.0.2 一起使用
- python - python - 如何提取 DOCX 超链接的文本?
- logstash - logstash 自定义模式没有得到解决