<template>
<component src="@/js/code1.js" :is="'script'"></component> //not work?
<component src="../js/code1.js" :is="'script'"></component> //not work?
<component src="./js/code1.js" :is="'script'"></component> //not work?
<img src="@/js/logo.png"/> //work as expected
<img src="../js/logo.png"/> //work as expected
<img src="./js/logo.png"/> //not work as expected
</template>
“code1.js” and “logo.png” are in the same “js” folder.
In Vue3 Vite, URL automatically resolved for the different folder path of dev and production builds. But it do not work in script tag. How to add a JS script file in the Vue3, which should work in both dev and production builds?