Open meduzen opened 2 years ago
Took me a while today to find this out. Thanks for the info.
how about this
we can chang this function
` // before export function urlToRequire( url: string, transformAssetUrlsOption: TransformAssetUrlsOptions = {}, ): string { const returnValue = "${url}" if ( isExternalUrl(url) || isDataUrl(url) || isHashUrl(url) || isAbsolute(url) ) return returnValue
// ........ } `
` // after export function urlToRequire( url: string, transformAssetUrlsOption: TransformAssetUrlsOptions = {}, ): string { const returnValue = "${url}" if ( isExternalUrl(url) || isDataUrl(url) || isHashUrl(url) ) return returnValue
if (isAbsolute(url)) { // inject vite.options.base in transformAssetUrlsOption return transformAssetUrlsOption.base + url } ........ } `
When providing the
base
option to Vite config, it is ignored byvite-plugin-vue2
, the assets referenced in<template>
end up having a wrong path, because the base path isn’t prepended.I created a minimal reproduction repository containing the exact same app written in Vue 2 and Vue 3, with all the details.
Let me know if it’s enough to help.