You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
// plugin-1.tsimport{plugin}from"bun";plugin({name: "plugin-1",setup(build){console.log("hello world #plugin-1 from setup");build.onLoad({filter: /\.(ts|tsx)$/},async(args)=>{console.log("hello world #plugin-1 from onLoad");console.log(args.path);return{contents: awaitBun.file(args.path).text(),};});},});// plugin-2.tsimport{plugin}from"bun";plugin({name: "plugin-2",setup(build){console.log("hello world #plugin-2 from setup");build.onLoad({filter: /\.(ts|tsx)$/},async(args)=>{console.log("hello world #plugin-2 from onLoad");console.log(args.path);return{contents: awaitBun.file(args.path).text(),};});},});// plugin-3.tsimport{plugin}from"bun";plugin({name: "plugin-3",setup(build){console.log("hello world #plugin-3 from setup");build.onLoad({filter: /\.(ts|tsx)$/},async(args)=>{console.log("hello world #plugin-3 from onLoad");console.log(args.path);return{contents: awaitBun.file(args.path).text(),};});},});// bunfig.tomlpreload=["./plugin-1.ts","./plugin-2.ts","./plugin-3.ts"]// preload-test-file1.tsimport{foo}from"preload-test-file2"console.log("Hello, world!");foo();// preload-test-file2.tsexportconstfoo=()=>console.log("Foo!");
What is the expected behavior?
Not sure if it should either be (1)
//run: bun preload-test-file1.ts
hello world #plugin-1 from setup
hello world #plugin-2 from setup
hello world #plugin-3 from setup
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-2 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-3 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
hello world #plugin-2 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
hello world #plugin-3 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
Hello, world!
Foo!
or (2)
//run: bun preload-test-file1.ts
hello world #plugin-1 from setup
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
hello world #plugin-2 from setup
hello world #plugin-2 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-2 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
hello world #plugin-3 from setup
hello world #plugin-3 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-3 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
Hello, world!
Foo!
What do you see instead?
//run: bun preload-test-file1.ts
hello world #plugin-1 from setup
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/plugin2.ts
hello world #plugin-2 from setup
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file1.ts
hello world #plugin-1 from onLoad
/home/user/repo/bun-plugin-test/preload-test-file2.ts
Hello, world!
Foo!
Additional information
Not sure what is supposed to be the intended behaviour. Is it supposed to call all plugin setup() first before executing the onLoad() for each loading, or call setup() after every file is loaded by the plugin subsequently.
The build.onLoad is also called for plugin-2 when it shouldn't?
The text was updated successfully, but these errors were encountered:
What version of Bun is running?
1.0.30+1424a196f
What platform is your computer?
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
What is the expected behavior?
Not sure if it should either be (1)
or (2)
What do you see instead?
Additional information
Not sure what is supposed to be the intended behaviour. Is it supposed to call all plugin
setup()
first before executing theonLoad()
for each loading, or callsetup()
after every file is loaded by the plugin subsequently.The build.onLoad is also called for plugin-2 when it shouldn't?
The text was updated successfully, but these errors were encountered: