Skip to content

Commit

Permalink
fix: allow disabling transformAssetUrls
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jul 23, 2024
1 parent df28f79 commit 1a09896
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,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
Expand All @@ -146,7 +148,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 = {
Expand Down

0 comments on commit 1a09896

Please sign in to comment.