# How to import hdr files in vite?

**URL:** <https://discourse.threejs.org/t/how-to-import-hdr-files-in-vite/40096>\
**Category:** Questions\
**Tags:** hdr\
**Created:** [July 7, 2022, 4:25pm UTC](https://discourse.threejs.org/t/how-to-import-hdr-files-in-vite/40096 "2022-07-07T16:25:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PrakharGupta36](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prakhargupta36/32/27845_2.png) [@PrakharGupta36](https://discourse.threejs.org/u/PrakharGupta36)\
**Post date:** [July 7, 2022, 4:25pm UTC](https://discourse.threejs.org/t/how-to-import-hdr-files-in-vite/40096/1 "2022-07-07T16:25:27Z")

</div>

Here is a snapshot of the code

When I build using npm run dev it doesn’t create the hdr file because it’s not imported, does anyone know how I can change vite.config.js

 ![Screenshot 2022-07-07 at 9.50.04 PM](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/d/7d67378918de78eab39dde749729f171fdce674e.jpeg)

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [July 7, 2022, 6:11pm UTC](https://discourse.threejs.org/t/how-to-import-hdr-files-in-vite/40096/2 "2022-07-07T18:11:28Z")

</div>

Easiest thing is probably to use the Vite public directory:

> **[Static Asset Handling | Vite](https://vitejs.dev/guide/assets.html#the-public-directory)**
>
> Next Generation Frontend Tooling

---

<div class="post-metadata">

**Author:** ![drcmda](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@drcmda](https://discourse.threejs.org/u/drcmda)\
**Post date:** [July 7, 2022, 8:25pm UTC](https://discourse.threejs.org/t/how-to-import-hdr-files-in-vite/40096/3 "2022-07-07T20:25:05Z")

</div>

generally, you can never url fetch from “./…” that is a relative path, and whereever it leads is not valid because the bundler will create a single javascript file from everything inside /src. they are only used for imports. the correct path is “/hdri” and as don said, that folder has to be in /public.
