-
-
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
Add raw-loader to webpack rules. #1938
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Why not use .md extension? Isn't it the default extension for markdown? |
Mmmm... I think you're all right @viankakrisna . Maybe I could put both (txt is useful for other purposes). |
Personally I think this functionality can be done by fetching the *.md / *.txt files from public folder, but it would mean that the code would be async rather than using webpack's loader to read the files on requires/import, I think this has been discussed before in #1304 |
Hello, Ummm... But if you want to publish your README.md file inside an If you want, I can add the Markdown extension too in a new commit. Or I can Best regards from Barcelona! |
Well, i'm not the maintainer, so it's not up to me :D Just a curious stargazer. They also don't recommend imports from outside src, so i think it's not something they consider. I agree it could be beneficial, but there are pros and cons of adding feature as stated in #1304. Right now i think it's better to just use fetch or whatever to read .md files :) |
I do not believe we will merge this as-is but I believe it's worth keeping open for now so that we address this by the time 0.10 is released. Unfortunately, any changes like this are considered breaking, so I'd rather explore a different option which enables this in a more generic way (since I'm sure there will be requests for other things). Something along the lines of browserify's |
What is your use case for this? Why not use regular JS files with template literals? export default `
lalalala
lalalala
`; |
Hello @gaearon !!! It will be useful for avoiding duplicities. For instance, I need printing the README.md file inside a component of React. Every time that I, or another mate, make a change in this file this component will be automatically updated. And a MD file doesn't have export by default. I thought it was an interesting plugin of webpack to include, but maybe I'm wrong. |
I think we won’t be adding this for now. CRA is meant for apps and doesn’t really work well for component libraries right now. The use case you are suggesting sounds more like a component library. I think nwb supports that use case better, so I encourage you to take a look at it. We might support component libraries in the future. When we do, it will be a good time to add support for this (and Markdown files). |
Okay! Don't worry about it @gaearon . I thought it will be a useful plugin for the community. Best regards! |
That would be neat to have this support.. my current workaround is a script that will copy all the index.js into a index.source.js and that do
but it's an ugly workaround ( https://github.com/gre/gl-react/blob/bc4612c597b9b2c7431eeb1486609bb6cd4a0552/packages/cookbook/src/examples/gen.sh ) |
@gre I understand that, but we don’t support this use case (cookbooks, library examples etc) very well right now. It would be nice to do comprehensively at some point, but I don’t want to dilute the focus until features important for apps are all done (and they’re not). |
I added the raw-loader to webpack for txt files.
It will be useful for reading markdown files and print their content inside a component.