fix(build): force assets to go through vite pipeline during dev too (#3258)

pull/3265/head
Divyansh Singh 10 months ago committed by GitHub
parent 479a320731
commit c3d7f22bd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -95,6 +95,22 @@ export async function createVitePressPlugin(
} }
} }
const getMergedAssetUrlOptions = () => {
const { transformAssetUrls } = userVuePluginOptions?.template ?? {}
const assetUrlOptions = { includeAbsolute: true }
if (transformAssetUrls && typeof transformAssetUrls === 'object') {
// presence of array fields means this is raw tags config
if (Object.values(transformAssetUrls).some((val) => Array.isArray(val))) {
return { ...assetUrlOptions, tags: transformAssetUrls as any }
} else {
return { ...assetUrlOptions, ...transformAssetUrls }
}
} else {
return assetUrlOptions
}
}
// lazy require plugin-vue to respect NODE_ENV in @vue/compiler-x // lazy require plugin-vue to respect NODE_ENV in @vue/compiler-x
const vuePlugin = await import('@vitejs/plugin-vue').then((r) => const vuePlugin = await import('@vitejs/plugin-vue').then((r) =>
r.default({ r.default({
@ -105,7 +121,8 @@ export async function createVitePressPlugin(
compilerOptions: { compilerOptions: {
...userVuePluginOptions?.template?.compilerOptions, ...userVuePluginOptions?.template?.compilerOptions,
isCustomElement isCustomElement
} },
transformAssetUrls: getMergedAssetUrlOptions()
} }
}) })
) )

Loading…
Cancel
Save