JS files not packed when running npm run build

Hi!

I’m making a capacitor app, and to make things easier, I put my script into .js files instead of putting everything inside

<script src="./js/script1.js"></script>
<script src="./js/script2.js"></script>
<script src="./js/script3.js"></script>
<script src="./js/script4.js"></script>

However, none of those scripts are packed with the app when I do npm run build.

I’m not using type=“modules”, because my scripts depend on each other (ex: script has functions used in script1, script2, etc) and apparently modules can’t share variables/functions globally (and I don’t want to rewrite everything to add exports etc, would be impossible)

It worked fine when I put the code directly inside <script> tags tho.

(I don’t use any framework, my app is pure HTML/CSS/JS)

I found a temporary solution by copy/pasting all my javascript inside a script tag with the attribute module, but my index.html is now 1200 lines long and it’s a total mess.

How can I fix this?