Hello! How can I add files (such as .png, .obj (3d...
# javascript
n
Hello! How can I add files (such as .png, .obj (3d model)) in webpack and use their paths in code? As reference, I use this project without any changes to config. In local experiments, I start a local server and get files by paths ""

http://127.0.0.1:5500/my_file.png

". Is there a similar way?
t
Do you want to embed files inside js script?
Or you want to have static assets?
n
In js it looks like this.
Copy code
const textureLoader = new THREE.TextureLoader();
const blocksBaseColor = textureLoader.load("<http://127.0.0.1:5500/textures/blocks-basecolor.jpg>");
In documentation
load
receives url — the path or URL to the file. This can also be a Data URI.
t
Move you files to
src/main/resources
This folder will be copied to distribution
n
Thx! Will check this out