-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't import jsonc as config file #9055
Labels
bug
Something isn't working
Comments
hmm this is supposed to work but i don't think we have tests for it |
@Jarred-Sumner Hi my friend, jsonc is very useful when used to create a config file. We need more comments to describe keys. |
Here is the relevant part in pub fn isJSONCFile(this: *const Path) bool {
const str = this.name.filename;
if (!(strings.hasPrefixComptime(str, "tsconfig.") or strings.hasPrefixComptime(str, "jsconfig."))) {
return false;
}
return strings.hasSuffixComptime(str, ".json");
} So
{
// comment
"foo": "bar"
}
const jsonc = await import('./tsconfig.json');
console.log('jsonc: ', jsonc); bun run index.js
jsonc: Module {
default: {
foo: "bar",
},
foo: "bar",
} |
resolved in v.1.1.5
Thank you support |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Bun is running?
1.0.27+c34bbb2e3
What platform is your computer?
Linux 6.3.6-arch1-1 x86_64 unknown
What steps can reproduce the bug?
Bun.sh can't read jsonc file from import
What is the expected behavior?
return an object as :
What do you see instead?
Additional information
I want to use config file in jsonc format for comments
The text was updated successfully, but these errors were encountered: