Uh oh!
There was an error while loading. Please reload this page.
Add support for a static folder - #226
Conversation
It is a nice escape hatch, ref: #28
gaearon
commented
Jul 30, 2016
Can you please rebase this? I want to take a look this week. |
mxstbr
commented
Jul 30, 2016
Put it on my todo list, will do this evening! |
mxstbr
commented
Jul 30, 2016
Rebased! |
gaearon
commented
Aug 8, 2016
What happens if I just reference |
mxstbr
commented
Aug 9, 2016
Don't have time to try it out at the moment I'm afraid! |
mikaelbr
commented
Aug 9, 2016
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><linkrel="icon" href="static/favicon/favicon-16.png" sizes="16x16" type="image/png"><linkrel="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. |
gaearon
commented
Aug 9, 2016
@mikaelbr Haha thanks for feedback on this! |
sco
commented
Aug 10, 2016
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 |
sco
commented
Aug 10, 2016
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. ( |
mikaelbr
commented
Aug 10, 2016
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 |
lacker
commented
Aug 10, 2016
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 |
tal
commented
Aug 29, 2016
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
|
mxstbr
commented
Aug 29, 2016
Nope, then they should go into the |
tal
commented
Aug 29, 2016
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. |
davidascher
commented
Aug 29, 2016
@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. |
tal
commented
Aug 29, 2016
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 notifications@github.com
|
SpaceK33z
commented
Aug 31, 2016
@tal, in that case, maybe a package like webpack-manifest-plugin would be interesting. It works by adding this to your webpack loader config: |
gaearon
commented
Sep 2, 2016
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. |
gaearon
commented
Sep 13, 2016
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? |
gaearon
left a comment
There was a problem hiding this comment.
/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.
kahneraja
commented
Sep 17, 2016
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? |
gaearon
commented
Sep 22, 2016
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! |
gaearon
commented
Sep 23, 2016
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.