We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
plugin.ts
import { writeFileSync } from "fs"; import { dirname, resolve } from "path"; Bun.plugin({ name: "toml", setup(build) { build.onResolve({ filter: /\.toml$/ }, (args) => { const path = resolve(dirname(args.importer), args.path); writeFileSync( `${path}.d.ts`, `export default ${JSON.stringify(require(path))}` ); return { path }; }); }, });
then register it as a plugin with bunfig.toml:
bunfig.toml
preload = "./plugin.ts"
and run this code:
test.ts
import bunfig from "./bunfig.toml"; console.log(bunfig);
i sometimes also got this:
1 | import bunfig from "./bunfig.toml"; 2 | console.log(bunfig); ^ SyntaxError: Unexpected token ')' at <parse> (/home/hussein/project/test.ts:2:1)
Bun v1.1.44-canary (8c04818) on linux x86_64 [AutoCommand]
8c04818
Segmentation fault at address 0x00000000
js_printer.zig:3016
src.js_printer.NewPrinter
js_printer.zig:2236
js_printer.zig:4558
js_printer.zig:5796
src.transpiler.Transpiler.printWithSourceMap__anon_123907
module_loader.zig:1902
src.bun.js.module_loader.ModuleLoader.transpileSourceCode__anon_123817
module_loader.zig:2383
Bun__transpileFile
ModuleLoader.cpp:782
Bun::fetchESMSourceCodeAsync
ZigGlobalObject.cpp:4245
Zig::GlobalObject::moduleLoaderFetch
Features: tsconfig_paths, bunfig, jsc, tsconfig, tsconfig
Sentry Issue: BUN-BR6
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How can we reproduce the crash?
plugin.ts
then register it as a plugin with
bunfig.toml
:and run this code:
test.ts
Relevant log output
i sometimes also got this:
Stack Trace (bun.report)
Bun v1.1.44-canary (
8c04818
) on linux x86_64 [AutoCommand]Segmentation fault at address 0x00000000
js_printer.zig:3016
:src.js_printer.NewPrinter
js_printer.zig:2236
:src.js_printer.NewPrinter
js_printer.zig:4558
:src.js_printer.NewPrinter
js_printer.zig:5796
:src.transpiler.Transpiler.printWithSourceMap__anon_123907
module_loader.zig:1902
:src.bun.js.module_loader.ModuleLoader.transpileSourceCode__anon_123817
module_loader.zig:2383
:Bun__transpileFile
ModuleLoader.cpp:782
:Bun::fetchESMSourceCodeAsync
ZigGlobalObject.cpp:4245
:Zig::GlobalObject::moduleLoaderFetch
Features: tsconfig_paths, bunfig, jsc, tsconfig, tsconfig
Sentry Issue: BUN-BR6
The text was updated successfully, but these errors were encountered: