Skip to content

Commit 25f6f30

Browse files
authored
fix: use uint8array for wasm module instead of base64 decoding (#2739)
1 parent 7e932bc commit 25f6f30

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/build/functions/edge.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,13 @@ const writeHandlerFile = async (ctx: PluginContext, { matchers, name }: NextDefi
9797
await writeFile(
9898
join(handlerDirectory, `${handlerName}.js`),
9999
`
100-
import { decode as _base64Decode } from './edge-runtime/vendor/deno.land/[email protected]/encoding/base64.ts';
101100
import { init as htmlRewriterInit } from './edge-runtime/vendor/deno.land/x/[email protected]/src/index.ts'
102-
import {handleMiddleware} from './edge-runtime/middleware.ts';
101+
import { handleMiddleware } from './edge-runtime/middleware.ts';
103102
import handler from './server/${name}.js';
104103
105-
await htmlRewriterInit({ module_or_path: _base64Decode(${JSON.stringify(
106-
htmlRewriterWasm.toString('base64'),
107-
)}).buffer });
104+
await htmlRewriterInit({ module_or_path: Uint8Array.from(${JSON.stringify([
105+
...htmlRewriterWasm,
106+
])}) });
108107
109108
export default (req, context) => handleMiddleware(req, context, handler);
110109
`,

0 commit comments

Comments
 (0)