Skip to content

What is the correct way of using a static / assets folder with Parcel 2? #4716

Answered by mischnic
halvardssm asked this question in General
Discussion options

You must be logged in to vote

Parcel 1:

import logo from "static/logo.png";

render(){
  return <div><img src={logo} /></div>
}

Parcel 2:

import logo from "url:static/logo.png";

render(){
  return <div><img src={logo} /></div>
}

(The full path of the asset has to be statically analyzable)

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@halvardssm
Comment options

@mischnic
Comment options

@halvardssm
Comment options

@mischnic
Comment options

@ghost
Comment options

Answer selected by halvardssm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants