File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { readFile , writeFile } from 'node:fs/promises'
2
+ import { existsSync } from 'node:fs'
2
3
import { createHash } from 'node:crypto'
3
4
import { type Resolver , resolvePath , useNuxt } from '@nuxt/kit'
4
5
import type { Nuxt } from '@nuxt/schema'
@@ -48,6 +49,14 @@ export async function setupBuildHandler(config: ModuleOptions, resolve: Resolver
48
49
. replaceAll ( '"@resvg/resvg-wasm/index_bg.wasm"' , `"${ path } index_bg-${ resvgHash } .wasm${ postfix } "` )
49
50
. replaceAll ( '"@css-inline/css-inline-wasm/index_bg.wasm"' , `"${ path } index_bg-${ cssInlineHash } .wasm${ postfix } "` )
50
51
. replaceAll ( '"yoga-wasm-web/dist/yoga.wasm"' , `"${ path } yoga-${ yogaHash } .wasm${ postfix } "` ) , { encoding : 'utf-8' } )
52
+ // TODO remove with next nitro bump
53
+ if ( target . includes ( 'cloudflare' ) ) {
54
+ const imgChunk = resolve ( dirname ( serverEntry ) , './chunks/handlers/image.mjs' )
55
+ existsSync ( imgChunk ) && await writeFile ( imgChunk , ( await readFile ( serverEntry , 'utf-8' ) )
56
+ . replaceAll ( '"@resvg/resvg-wasm/index_bg.wasm"' , `"${ path } index_bg-${ resvgHash } .wasm${ postfix } "` )
57
+ . replaceAll ( '"@css-inline/css-inline-wasm/index_bg.wasm"' , `"${ path } index_bg-${ cssInlineHash } .wasm${ postfix } "` )
58
+ . replaceAll ( '"yoga-wasm-web/dist/yoga.wasm"' , `"${ path } yoga-${ yogaHash } .wasm${ postfix } "` ) , { encoding : 'utf-8' } )
59
+ }
51
60
} )
52
61
} )
53
62
}
You can’t perform that action at this time.
0 commit comments