mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
@@ -307,7 +307,7 @@ Depending on the target, Bun will apply different module resolution rules and op
|
||||
---
|
||||
|
||||
- `browser`
|
||||
- _Default._ For generating bundles that are intended for execution by a browser. Prioritizes the `"browser"` export condition when resolving imports. An error will be thrown if any Node.js or Bun built-ins are imported or used, e.g. `node:fs` or `Bun.serve`.
|
||||
- _Default._ For generating bundles that are intended for execution by a browser. Prioritizes the `"browser"` export condition when resolving imports. Importing any built-in modules, like `node:events` or `node:path` will work, but calling some functions, like `fs.readFile` will not work.
|
||||
|
||||
---
|
||||
|
||||
@@ -1272,7 +1272,17 @@ interface BuildArtifact extends Blob {
|
||||
sourcemap?: BuildArtifact;
|
||||
}
|
||||
|
||||
type Loader = "js" | "jsx" | "ts" | "tsx" | "json" | "toml" | "file" | "napi" | "wasm" | "text";
|
||||
type Loader =
|
||||
| "js"
|
||||
| "jsx"
|
||||
| "ts"
|
||||
| "tsx"
|
||||
| "json"
|
||||
| "toml"
|
||||
| "file"
|
||||
| "napi"
|
||||
| "wasm"
|
||||
| "text";
|
||||
|
||||
interface BuildOutput {
|
||||
outputs: BuildArtifact[];
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
export * from "string_decoder";
|
||||
export * as default from "string_decoder";
|
||||
export { StringDecoder, StringDecoder as default } from "string_decoder";
|
||||
|
||||
@@ -180,4 +180,20 @@ describe("bundler", () => {
|
||||
file: "/entry.js",
|
||||
},
|
||||
});
|
||||
|
||||
// https://github.com/oven-sh/bun/issues/3660
|
||||
itBundled("regression/StringDecoder#3660", {
|
||||
files: {
|
||||
"/entry.js": `
|
||||
import { StringDecoder } from 'string_decoder'
|
||||
|
||||
const decoder = new StringDecoder('utf8')
|
||||
const buf = Buffer.from([0xe4, 0xbd, 0xa0, 0xe5, 0xa5, 0xbd])
|
||||
const str = decoder.write(buf)
|
||||
|
||||
console.log(str)
|
||||
`,
|
||||
},
|
||||
run: { stdout: "你好" },
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user