Skip to content
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 resources are being rendered from the wrong place (on custom server) #541

Closed
DvirSh opened this issue Dec 27, 2016 · 3 comments
Closed

Comments

@DvirSh
Copy link

DvirSh commented Dec 27, 2016

I'm getting weird (and in my opinion wrong) behavior with static resources when I use custom server (on 2.0.0 Beta).
For example, if my custom server directs a request to "/blog/:id", then the static resources are being looked up in "./blog/static/image.jpg".

For easy reproduction, I've edited the render method of "blog" in "parameterized-routing":

return <div>
      <h1>My {this.props.id} blog post</h1>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua.
      </p>
      <img src="./static/x.jpg" />
    </div>

And ofcourse added an image named "x.jpg" to "static" folder.

I can work it around by looking the file in "../static/x.jpg", but this is wrong since it exploits the fact that blog does not sit under index.js.

@arunoda
Copy link
Contributor

arunoda commented Dec 27, 2016

@DvirSh could you send us a sample repo.
So, we could have a look at this closer.

@nkzawa
Copy link
Contributor

nkzawa commented Dec 28, 2016

Shouldn't it be <img src="/static/x.jpg" /> (no ./) ?
I assumed the page is served on /blog/id.

@DvirSh
Copy link
Author

DvirSh commented Dec 29, 2016

@nkzawa your'e right!

@DvirSh DvirSh closed this as completed Dec 29, 2016
@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants