Skip to content
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

Support import with { type: "json" } and others #16624

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

Conversation

pfgithub
Copy link
Contributor

What does this PR do?

Fixes:

import config from "./.prettierrc" with { type: "json" };
console.log(config);
// before: /path/to/.prettierrc
// after: (contents)
await import("./some.file", {with: {type: "js"}});
// before: (crash)
// after: (imports some.file as js)

Breaking change: (bun.lock/tsconfig.json/... are unaffected) (must now use with {type: "jsonc"} or change the file path to .jsonc)

// a.ts
import config from "./my_jsonc_file.json"
console.log(config);
// before: `bun build a.ts` : works (different than `bun a.ts`)
// after: `bun build a.ts`: errors (same as `bun a.ts`)

@robobun
Copy link

robobun commented Jan 23, 2025

Updated 8:58 PM PT - Jan 22nd, 2025

@pfgithub, your commit 1e8a23c has 3 failures in #10371:


🧪   try this PR locally:

bunx bun-pr 16624

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants