diff --git a/.changeset/bright-forks-lick.md b/.changeset/bright-forks-lick.md new file mode 100644 index 00000000..71a16208 --- /dev/null +++ b/.changeset/bright-forks-lick.md @@ -0,0 +1,5 @@ +--- +"bob-the-bundler": patch +--- + +Use correct path for checking file existence in exports map. diff --git a/src/commands/check.ts b/src/commands/check.ts index 0277dff0..897eaf18 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -194,7 +194,7 @@ async function checkExportsMapIntegrity(args: { } else { // package.json or other files // for now we just make sure they exists - await fse.stat(cjsResult); + await fse.stat(path.join(args.cwd, cjsResult)); } const esmResult = resolve.resolve({ exports: exportsMap }, key); @@ -232,7 +232,7 @@ async function checkExportsMapIntegrity(args: { } else { // package.json or other files // for now we just make sure they exists - await fse.stat(esmResult); + await fse.stat(path.join(args.cwd, esmResult)); } } diff --git a/test/__fixtures__/simple/package.json b/test/__fixtures__/simple/package.json index 9230c1f8..5f2442aa 100644 --- a/test/__fixtures__/simple/package.json +++ b/test/__fixtures__/simple/package.json @@ -35,7 +35,8 @@ "default": "./dist/esm/*.js" } }, - "./package.json": "./package.json" + "./package.json": "./package.json", + "./style.css": "./style.css" }, "publishConfig": { "directory": "dist", @@ -45,7 +46,8 @@ "bob": { "build": { "copy": [ - "foo.json" + "foo.json", + "src/style.css" ] }, "check": { diff --git a/test/__fixtures__/simple/src/style.css b/test/__fixtures__/simple/src/style.css new file mode 100644 index 00000000..a15c877a --- /dev/null +++ b/test/__fixtures__/simple/src/style.css @@ -0,0 +1,3 @@ +.foo { + color: red; +} diff --git a/test/integration.spec.ts b/test/integration.spec.ts index 815bc7b3..891b8d76 100644 --- a/test/integration.spec.ts +++ b/test/integration.spec.ts @@ -83,7 +83,8 @@ it("can bundle a simple project", async () => { \\"default\\": \\"./esm/*.js\\" } }, - \\"./package.json\\": \\"./package.json\\" + \\"./package.json\\": \\"./package.json\\", + \\"./style.css\\": \\"./style.css\\" } }" `);