-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static asset in-lining #1944
Comments
hurray for something like brfs! brfs have some issues though if we want to implement it using transform-loader webpack-contrib/transform-loader#3 do you eye-ing for something else? |
Would love to see a proof of concept. |
Possible solutions:
|
|
i really want this, but i'm not sure how to do it effectively. i see a few options:
i'm liking the 3rd option. thoughts? |
What's wrong with using fs.readFileSync? That's convention in the browserify world. |
i suppose we could do that, @Timer, it just feels a little funky to not use webpack for the single source of asset aggregation. even tho i love node, seeing i'm not powerfully swayed one way or the other, but continuing to use webpack + an ENV var feels like it may render less friction |
While debate continues on this, you can use raw-loader today without ejecting or forking with: /* eslint import/no-webpack-loader-syntax: off */
import QuickStart from '!raw-loader!./Sections/QuickStart.md'; The leading I know this isn't recommended, but I find an explicit binding to Webpack to be more palatable than eject or forking. Feels like a tradeoff between trouble caused by some hypothetical future state where CRA no longer uses Webpack and trouble now maintaining my fork or falling behind on updates to key pieces of the setup. |
@jkschneider be aware that we might break this in the future. It's not permitted behavior. |
Related: #3722. |
Note that the !raw-loader! approach breaks the jest tests. |
Closing in favor of above linked issue. |
When 0.10 is released (with #1305), I have a feeling we'll be seeing a lot more of issues like #1938.
These users have a perfectly legitimate use case and I believe we should handle it.
They desire to require a text file, or other types (e.g. markdown, other markup), and receive raw data. There was also a recent issue asking to require JS as text and not processed as a module.
There are many imaginable use cases for this, and have been a huge amount of issues we've responded to with a
To remedy this, I believe we should in-line assets via
fs.readFileSync(...)
, similar (identical) tobrfs
.This would allow users to require any arbitrary file as UTF8 text or a
Buffer
.The text was updated successfully, but these errors were encountered: