summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/npm/cjs_yargs/main.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-11-06 00:58:21 +0100
committerGitHub <noreply@github.com>2022-11-06 00:58:21 +0100
commite7d7da85dff177bbc919cab48643135c68e065bd (patch)
treeee6ddb2abe715b80ad0334750e262ef7145f7975 /cli/tests/testdata/npm/cjs_yargs/main.js
parent384e53308a7d7e5d503e9cbf9950ab428048ac4c (diff)
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.
Diffstat (limited to 'cli/tests/testdata/npm/cjs_yargs/main.js')
-rw-r--r--cli/tests/testdata/npm/cjs_yargs/main.js20
1 files changed, 20 insertions, 0 deletions
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);