react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Require raw files

Open contextlimit opened this issue 10 years ago • 3 comments

I feel like it would be great if there were a standard way to bring in raw files.

This would help bridge the gap between webpack, with the lack of loaders, devs could be recommended to load the file raw and then run their loader/converter over that. That would make it easy to experiment with other file formats without introducing outside tools to the dev environment, keeping it in the build. It looks like something like this was requested in #231 but in his case he only had a use-case for JSON. Raw would give a future-proof (maybe temp) solution for different use-cases. I'm thinking of svgs, icons, css (interoperability with web).

Similar: https://github.com/webpack/raw-loader

Thoughts?

Appreciate feedback. Thanks in advance!

contextlimit avatar May 29 '16 17:05 contextlimit

This is an interesting idea, but doesn't that bloat the code base and add to memory usage of the JSC? This could lead to reduced load/launch times as well.

Would it be better to read off of the file system at runtime instead?

jaygarcia avatar Jun 03 '16 04:06 jaygarcia

@jaygarcia brings up a really good point. I think we should still support this since it's an escape hatch, but for large files it's super inefficient to load a massive string into native, then send it over to JS, and often send it back to native.

ide avatar Jun 03 '16 05:06 ide

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/require-raw-files

Product Pains has been very useful in highlighting the top bugs and feature requests: https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

mkonicek avatar Oct 27 '16 21:10 mkonicek