diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts index 0af6db09..3c698d88 100644 --- a/packages/plugin-vue/src/template.ts +++ b/packages/plugin-vue/src/template.ts @@ -131,7 +131,9 @@ export function resolveTemplateCompilerOptions( let transformAssetUrls = options.template?.transformAssetUrls // compiler-sfc should export `AssetURLOptions` let assetUrlOptions //: AssetURLOptions | undefined - if (options.devServer) { + if (transformAssetUrls === false) { + // if explicitly disabled, let assetUrlOptions be undefined + } else if (options.devServer) { // during dev, inject vite base so that compiler-sfc can transform // relative paths directly to absolute paths without incurring an extra import // request @@ -145,7 +147,7 @@ export function resolveTemplateCompilerOptions( includeAbsolute: !!devBase, } } - } else if (transformAssetUrls !== false) { + } else { // build: force all asset urls into import requests so that they go through // the assets plugin for asset registration assetUrlOptions = {