Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

Loading images in css #93

Closed
Closed

Description

@sergeysova

I try:

# ./style.css
.searchBg {
  background-image: url(sprite/searchBg.jpg)
}
# ./component.js
import css from './style.css';

// begin component
  <div className={css.searchBg} />
// end component

What i see in chrome:
image

But image not loading to background.
When i click on "Open Link in new tab", link opens as:

image

Activity

  1. Strate commented on Dec 3, 2015

    @Strate

    From README:

    Note about source maps support and assets referenced with url: when style loader is used with ?sourceMap option, the CSS modules will be generated as Blobs, so relative paths don't work (they would be relative to chrome:blob or chrome:devtools). In order for assets to maintain correct paths setting output.publicPath property of webpack configuration must be set, so that absolute paths are generated.

    Btw, why style-loader can not replace relative urls to absolute urls by itself?

  2. tizmagik commented on Feb 1, 2016

    @tizmagik

    See #55 for some workarounds/solutions to this issue.

  3. michael-ciniawsky commented on Mar 6, 2017

    @michael-ciniawsky
    Contributor

    Will be fixed by either #96 or #124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions