Skip to content

Commit 83a4d92

Browse files
committed
chore: use uint8array for wasm module instead of base64 decoding
1 parent 7e932bc commit 83a4d92

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/build/functions/edge.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ 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'
102101
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(${
105+
JSON.stringify(
106+
Array.prototype.slice.call(htmlRewriterWasm.buffer),
107+
)
108+
}) });
108109
109110
export default (req, context) => handleMiddleware(req, context, handler);
110111
`,

0 commit comments

Comments
 (0)