Skip to content

[BUG] in styled jsx loaders not apply to images #12158

@MaxmaxmaximusGitHub

Description

@MaxmaxmaximusGitHub

i have files
/pages/_App.js
/res/images/image.jpg

export default function App() {

  // language=Stylus
  return <style jsx global>{ `
	body {
		background-image: url("../res/images/image.jpg");
	}
  ` }</style>
}

Problem

url("../res/images/image.jpg") will not replace to /_next/static/images/lol-c8bbed083d312e8f1cccb6069d6f7919.png. styled jsx not applied webpack loaders, and not create optimized next.js assets

Temporary solution

export default function App() {

  // language=Stylus
  return <style jsx global>{ `
	body {
		background-image: url(${ require("../res/images/image.jpg") });
	}
  ` }</style>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions