简体   繁体   中英

vite build does not produce javascript file in dist folder

I am trying to deploy my vanilla JS app to Firebase hosting. I am using Vite as a build tool.

When I run it locally, it works fine. But when I deploy it to Firebase hosting, I realized that it was missing main.js file.

I checked my dist folder generated by Vite, and it was indeed missing main.js file.

I never ran into this issue before when using JS framework, but now I am with Vanilla JS.

How can I make sure that my build will contain javascript file as well?

Your script tag should look like this :

<script src="./main.js" type="module"></script>

There must be an attribute :

type="module"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM