Skip to content

Commit

Permalink
Add info about node:${module} syntax for nodejs_compat (#4485)
Browse files Browse the repository at this point in the history
* Add info about `node:${module}` syntax for nodejs_compat

* Update error message for nodejs_compat in wrangler tests

* Fix error message matched about nodejs_compat
  • Loading branch information
zmilonas committed Dec 18, 2023
1 parent c628de5 commit cd4f63a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7717,7 +7717,7 @@ export default{
expect(
esbuild.formatMessagesSync(err?.errors ?? [], { kind: "error" }).join()
).toMatch(
/The package "path" wasn't found on the file system but is built into node\.\s+Add "node_compat = true" to your wrangler\.toml file to enable Node.js compatibility\./
/The package "path" wasn't found on the file system but is built into node\.\s+Add "node_compat = true" to your wrangler\.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility\./
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export default {
'The package "node:async_hooks" wasn\'t found on the file system but is built into node.'
);
expect(std.err).toContain(
'Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.'
'Add the "nodejs_compat" compatibility flag to your Pages project and make sure to prefix the module name with "node:" to enable Node.js compatibility.'
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/deployment-bundle/build-failures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function rewriteNodeCompatBuildFailure(
forPages
? 'Add the "nodejs_compat" compatibility flag to your Pages project'
: 'Add "node_compat = true" to your wrangler.toml file'
} to enable Node.js compatibility.`;
} and make sure to prefix the module name with "node:" to enable Node.js compatibility.`;

error.notes = [
{
Expand Down

0 comments on commit cd4f63a

Please sign in to comment.