Skip to content

Commit 16952de

Browse files
authored
fix: use correct path for checking the integrity of a non js file (#109)
1 parent ebda07c commit 16952de

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

.changeset/bright-forks-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"bob-the-bundler": patch
3+
---
4+
5+
Use correct path for checking file existence in exports map.

src/commands/check.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ async function checkExportsMapIntegrity(args: {
194194
} else {
195195
// package.json or other files
196196
// for now we just make sure they exists
197-
await fse.stat(cjsResult);
197+
await fse.stat(path.join(args.cwd, cjsResult));
198198
}
199199

200200
const esmResult = resolve.resolve({ exports: exportsMap }, key);
@@ -232,7 +232,7 @@ async function checkExportsMapIntegrity(args: {
232232
} else {
233233
// package.json or other files
234234
// for now we just make sure they exists
235-
await fse.stat(esmResult);
235+
await fse.stat(path.join(args.cwd, esmResult));
236236
}
237237
}
238238

test/__fixtures__/simple/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"default": "./dist/esm/*.js"
3636
}
3737
},
38-
"./package.json": "./package.json"
38+
"./package.json": "./package.json",
39+
"./style.css": "./style.css"
3940
},
4041
"publishConfig": {
4142
"directory": "dist",
@@ -45,7 +46,8 @@
4546
"bob": {
4647
"build": {
4748
"copy": [
48-
"foo.json"
49+
"foo.json",
50+
"src/style.css"
4951
]
5052
},
5153
"check": {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.foo {
2+
color: red;
3+
}

test/integration.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ it("can bundle a simple project", async () => {
8383
\\"default\\": \\"./esm/*.js\\"
8484
}
8585
},
86-
\\"./package.json\\": \\"./package.json\\"
86+
\\"./package.json\\": \\"./package.json\\",
87+
\\"./style.css\\": \\"./style.css\\"
8788
}
8889
}"
8990
`);

0 commit comments

Comments
 (0)