Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-vue): allow disabling transformAssetUrls #326

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/plugin-vue/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = {
Expand Down