compile into single file
Bundling the bot into a single file fails because sapphire loads commands/listeners files when run, not via import. Is there a simple setting in the bot to statically import all the commands?
26 Replies
What is the reason to deploy a single file?
works easier with the hosting provider. can't change this circumstance, need static imports, but don't see any docs on that
I don't think you can override that
you're saying this would require editing the sapphire framework?
More like not supported?
It revolves around pieces which are loaded at runtime
how necessary are those pieces to be loaded at runtime though
considering that's how every single part of sapphire works really rough
Everything in sapphire is a piece
yeah basically
it's built around pieces as modules
you just add more moduels to load more commands or your own modules
you don't bundle really
It would seem your best option is to use a hosting provider that allows you to have more than one file
in fact I'd say bundling is probably an anti pattern here
huh
well ty for preventing me from wasting hours to mold sapphire to do that
yeah wouldn't want that
still gotta somehow get it bundled unfortunately. ill find another way ig
maybe you're going down the wrong path
take a closer look at your hosting solution
maybe you're not limited
Yeah I’d either switch hosting providers or switch frameworks but honestly a provider with limits like that is probably just going to cause you more headaches down the line
1 bundled file remains ideal
headaches? works fine with 2 other bots hosted, but they're not on sapphire
kinda curious tho why pieces are a must
sure it removes some boilerplate of specifying where commands are by automatically detecting them
but its not like you cant make bots without loading extra scripts at runtime
I’m just thinking that if they have a massive limit of only one file, what other massive limits need to be worked around. Personally I’d prefer to know I won’t run into stuff like that.
The whole internal structure of the framework is also piece based
why tho
It’s now pretty much everything works in sapphire
but why not just
import {mod} from "bar";
because we load them on demand
also means it's dynamic and extendable
e.g. you're not tied to any specific path structure
you can unload and load modules at any time, reload them, etc
Because that’s not really doable when you don’t know what
mod
is called or where bar
is. Basing things odd the file structure allows you to know what stuff is called and still load it on demand.hmm, hows this different from something like vites hmr?
so this basically
considering vite is a build tool and pieces is a generic module loader for importing classes at runtime there is little similarities
hmr really is just a file watch system that can tell the bundler to re-import that value
pieces can do that but you don't watch the system you call it manually
it's a low level construct
it's not something as a bot developer you'd use
i see