@@ -340,6 +340,21 @@ describe("runtimeVersion 1", () => {
340340 expect ( output ) . toMatchSnapshot ( )
341341 } )
342342
343+ it ( "removes `node:` import prefixes" , async ( ctx ) => {
344+ const input = dedent `
345+ import crypto from "node:crypto"
346+
347+ var hash = crypto.createHash("sha1")
348+ hash.update("data")
349+ hash.digest("base64")
350+ `
351+ const result = await buildFile ( ctx , input )
352+
353+ const output = getOutput ( result )
354+ expect ( output ) . not . toContain ( "node:" )
355+ expect ( output ) . toContain ( 'from "crypto"' )
356+ } )
357+
343358 it ( "minification does not rename handler function" , async ( ctx ) => {
344359 const input = dedent `
345360 function handler(event: Record<string, unknkown>) {
@@ -672,6 +687,22 @@ describe("runtimeVersion 2", () => {
672687 const output = getOutput ( result )
673688 expect ( output ) . toMatchSnapshot ( )
674689 } )
690+
691+ it ( "removes `node:` import prefixes" , async ( ctx ) => {
692+ const input = dedent `
693+ import crypto from "node:crypto"
694+
695+ var hash = crypto.createHash("sha1")
696+ hash.update("data")
697+ hash.digest("base64")
698+ `
699+ const result = await buildFile ( ctx , input )
700+
701+ const output = getOutput ( result )
702+ expect ( output ) . not . toContain ( "node:" )
703+ expect ( output ) . toContain ( 'from "crypto"' )
704+ } )
705+
675706 it ( "minification does not rename handler function" , async ( ctx ) => {
676707 const input = dedent `
677708 function handler(event: Record<string, unknkown>) {
0 commit comments