From e7d7da85dff177bbc919cab48643135c68e065bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 6 Nov 2022 00:58:21 +0100 Subject: fix(npm): fix CJS resolution with local node_modules dir (#16547) This commit fixes CJS resolution when there's a local "node_modules/" directory. Before this commit relative imports from CJS files where resolved relative to root directory of the package instead of relative to referrer file. --- cli/tests/testdata/npm/cjs_yargs/main.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 cli/tests/testdata/npm/cjs_yargs/main.js (limited to 'cli/tests/testdata/npm/cjs_yargs/main.js') diff --git a/cli/tests/testdata/npm/cjs_yargs/main.js b/cli/tests/testdata/npm/cjs_yargs/main.js new file mode 100644 index 000000000..832fd053c --- /dev/null +++ b/cli/tests/testdata/npm/cjs_yargs/main.js @@ -0,0 +1,20 @@ +import yargs from "npm:yargs@15.4.1"; + +const args = yargs(["serve", "8000"]) + .command("serve [port]", "start the server", (yargs) => { + return yargs + .positional("port", { + describe: "port to bind on", + default: 5000, + }); + }, (argv) => { + console.info(`start server on :${argv.port}`); + }) + .option("verbose", { + alias: "v", + type: "boolean", + description: "Run with verbose logging", + }) + .argv; + +console.log(args); -- cgit v1.2.3