What I am looking to achieve is roughly:
1.Import resources in the import statement
import earth from '../assets/earth.png'
2.Then use it in the code
let img = new Image();
img.src=earth
In this case, print value of earth is 'assets/earth.png', but my img cannot correctly read the path.
What I am looking to achieve is roughly:
1.Import resources in the import statement
import earth from '../assets/earth.png'2.Then use it in the code
In this case, print value of earth is 'assets/earth.png', but my img cannot correctly read the path.