Giter VIP home page Giter VIP logo

Comments (7)

kepta avatar kepta commented on June 7, 2024 1

Also, looks like there is some bug in the way development server is hosting static assets. Needs more investigation.

from underreact.

davidtheclark avatar davidtheclark commented on June 7, 2024 1

Sounds to me like there's a bug in Underreact. In @benjamintd's example, during local development the image should be available at localhost:8080/my-site/images/image.jpg. @kepta can you please look into this?

from underreact.

kepta avatar kepta commented on June 7, 2024

Thanks for opening this issue @otherwiseman , looks like there is a bug in the docs. The default value for publicDirectory is ${project-root}/public/ and not ${project-root}/src/public/.

from underreact.

otherwiseman avatar otherwiseman commented on June 7, 2024

Thanks for your assistance and for summarizing here @kepta -- images are working in production now and local development is less of a priority so no worries. Appreciate the timely help!

from underreact.

kepta avatar kepta commented on June 7, 2024

@otherwiseman if you keep your images in the ${project-root}/public/ folder, you should be able to get them working by using a relative link, for eg: <img src="gs01_search.png" > should work both in development and production modes.

However, I suggest keeping your images in ${project-root}/public/images and then reference them like <img src="images/gs01_search.png" > .

from underreact.

davidtheclark avatar davidtheclark commented on June 7, 2024

Hm, I'd generally recommend (strongly) using root-relative or absolute URLs instead of relative URLs. @kepta What do we need to change about Underreact to enable root-relative URLs to work for public assets?

from underreact.

benjamintd avatar benjamintd commented on June 7, 2024

@davidtheclark I'm running into the same issue with this setup:

  • assets are placed in <project-root>/public/images/image.jpg
  • in my config I have siteBasePath: '/my-site'
  • during local development, I access my index.html file at localhost:8080/my-site/index.html and my file at localhost:8080/images/image.jpg
  • in production, the index is at www.example.com/my-site/index.html and the image at www.example.com/my-site/images/image.jpg.

Since I'm loading these images dynamically I can't import them all as documented here.

How do you think we should reference those assets?

from underreact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.