Skip to content

Commit

Permalink
fix(img): handle ststic images in with prod server target
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 21, 2021
1 parent 339b7dd commit 95dd0c6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/runtime/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ export function createImage (globalOptions: CreateImageOptions, nuxtContext) {

function $img (input: string, options: ImageOptions = {}) {
const image = resolveImage(ctx, input, options)
if (image.isStatic) {
handleStaticImage(image, input)
}
return image
}

// Full static
if (process.static && image.isStatic) {
function handleStaticImage (image: ResolvedImage, input: string) {
if (process.static) {
const staticImagesBase = '/_nuxt/image' // TODO

if (process.client && 'fetchPayload' in window.$nuxt) {
Expand All @@ -37,9 +42,9 @@ export function createImage (globalOptions: CreateImageOptions, nuxtContext) {
}
}
}
} else if (process.env.NODE_ENV === 'production') {
image.url = input
}

return image
}

$img.options = globalOptions
Expand Down

0 comments on commit 95dd0c6

Please sign in to comment.