Bun Glob scan have different order than using node #10112
Answered
by
truongan07
huyhoang160593
asked this question in
Q&A
Replies: 2 comments
-
let list = [];
for await (const path of globalThis.Bun.Glob('./*/*').scan({ absolute: true })) list.push(path);
list = list.sort((find, string) => string.toString().trim().toLocaleLowerCase().localeCompare(find.toString().trim().toLocaleLowerCase())).reverse();
console.log(list); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Jarred-Sumner
-
Relying on filesystem order will likely cause issues like this. The operating system returns files in the order it wants, we have little control over that without manually sorting ourselves. On a different computer, it would return potentially in a different order. Your best bet is to sort them as @truongan07 shows |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an fastify app which using autoload plugin to load all my plugins before create router. Which I have order for the plugins to load cause of dependency.
This is my original order that run fine in nodejs + tsx
But when I use bun, this is the order that bun load and they messes up my application
How can I solve this for running my application
Beta Was this translation helpful? Give feedback.
All reactions