Don't Include Asset in Compiled File

Viewed 37

In this example, I'm trying to figure out how to make vite not include the test.svg file directly in the dist/index.js file AND not transpile the file to a base64 string. Basically, I want dist/index.js to still import the file, but I want it to be relative to the final build, as this will be used as an external package.

I understand that I can put the file in the public dir, but the problem with that is when I include this package in my app, the file doesn't have the proper path... it still reads as /pubTest.svg, but it really should be ./pubTest.svg or something that's relative to its directory.

I had a look at the Static Asset Handling guide, but none of those options seemed to solve the problem. So how do I get this asset file to be included in my build, but have the proper path to the file?

0 Answers
Related