-
-
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 support for a static folder #226
Conversation
It is a nice escape hatch, ref: #28
Can you please rebase this? I want to take a look this week. |
Put it on my todo list, will do this evening! |
Rebased! |
What happens if I just reference |
Don't have time to try it out at the moment I'm afraid! |
Interesting thread! I was just experiencing this "short coming" today while testing out @gaearon I tested out referencing the As a maybe "happy accident", by calling this Now it might feel "magical" that you have to create the Having something like this:
And in index.html: ...
<title>React App</title>
<link rel="icon" href="static/favicon/favicon-16.png" sizes="16x16" type="image/png">
<link rel="icon" href="static/favicon/favicon-32.png" sizes="32x32" type="image/png">
... This way it would be easy to understand how to use it, and that it even exists. Just wanted to chime in and managed to write an entire essay doing so. |
@mikaelbr Haha thanks for feedback on this! |
For a Service Worker to control a site, it has to be placed at the root. I.e., a service worker at Any concern with simply removing the |
I can see how it might be a little confusing, but I think @mikaelbr's suggestion of putting the favicons there, and referencing them from I suspect putting arbitrary files at the root of a project will be a fairly common need. ( |
There might be several files that are required to be in the root, so there might be a need to do this as well. What is the possible downsides of copying files from root to root? By just copying files it'll be easier to restrict what files to actually copy and reduce the build-directory, but it might be more more confusing; "why do this files work, but I can't find |
If you have a backend to your app, serving arbitrary static files from the root url that your webserver serves generally is not a good idea, because then you can't use a regex in your nginx/apache config to decide whether to route things to your static file service mechanism or to your backend. You usually want to special-case a small number of files, like Perhaps you could actually work around this quite easily if you don't have a backend, by proxying to |
Depends on whether the associated images in there would be passed though I wouldn't mind building a pr for all this but have no clue if it's what
|
Nope, then they should go into the |
This is tangential to this PR, but if that's the case then And with that context I'd say that having static is a mistake that would lead to more confusion than it would solve. It gives 2 locations for things to be stored rather than just one. For those who need the more advanced behavior they can always eject and do themselves. |
@tal I personally have no useful opinion on layout or even what should or shouldn't go through the webpack transformation. On the topic of capabilities, though: I do think that it's good to have a fairly ambitious definition of what can be done without ejecting. So, in particular, serving favicons for all major OSes and as much of the progressive web app feature set as possible (good service workers defaults, etc.), should not require If those capabilities are accessible (but not required) in the default setup, then more people will implement them, and more webapps will be better webapps, which is good for users and good for the web. |
What i was meaning was that those favicon or icons of whatever sort for all On Mon, Aug 29, 2016 at 12:45 PM David Ascher [email protected]
|
@tal, in that case, maybe a package like webpack-manifest-plugin would be interesting. It works by adding this to your webpack loader config:
|
Sorry for the long turnaround on this. Instead, #428 should satisfy most use cases, and if not, we can address them on case by case basis (file issues!) Please see #551 for more comments on this, justification for not supporting this, and additional documentation that I believe adequately explains how #428 works as well as the behavior I ultimately want to have. Sorry 😥. |
We got some more feedback and I know more about the use cases people have for this. I couldn't find any better alternative so let's do it in the next minor. |
Thought some more about it. It won't work for non-relative roots (like GH Pages). People will reference Any ideas how to solve that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/static
won’t work on non-root hosting which is potentially confusing. I think we might need to come up with some other way of supporting this.
would love to help with this issue. it relates to the open graph meta tag issue i'm wanting resolve too. what should i try? |
I’m going to close this because I ended up with a different solution that I think addresses these concerns better: #703. Let me know what you think! |
This is now supported in 0.5.0. Read about using the new See also migration instructions and breaking changes in 0.5.0. |
It is a nice escape hatch, ref: #28
Verified by going through the entire flow (in all three states, i.e. node_modules, development and ejected) with npm start.