#Use modules for source when compiling with `--outFile`?
30 messages · Page 1 of 1 (latest)
@carmine turtle Yeah, there isn't a direct way to do this, AFAIK. TS really isn't a bundler
So "outfile" is mostly limited to old-school style patterns where you're just concatenating source files together.
Aha
I would recommend a build tool, e.g. vite. You don't need it to be a "second" build step because it can handle TS inputs.
What's the easiest way to set up a tool like vite? Any time I interact with vite normally I'm using a template that sets it up for me lol
You can do npm create vite and it automatically downloads and runs a vite setup wizard
Vite actually bundles using rollup. If you want to make a web app, then using vite for dev mode + using its build option with rollup makes sense.
(npm create X is a npm command that that downloads and runs a package called create-X)
If you literally just want to bundle some JS, I think you want rollup directly?
Yeah, vite doesn't bundle in dev because that's generally a nicer experience.
Yeah, Vite seems to have given me a bunch of extra stuff I don't need or want, so seems like Rollup is what I need
Rollup should be pretty easy, like ~10 lines of config
Or less
Bun has a bundler built in I learned recently, if using that.
What are you making exactly?
I am using Bun, actually
A plugin file for Cookie Clicker lol
Yeah, might be fine to just do that with rollup; though I'd probably miss the speed of some other tooling.
Vite can be used for just "library" usage and it's still helpful, but a lot of the vite stuff is aimed at website building/bundling.
Bun claims to be very fast
Yeah, it's probably not doing JS-based bundling like rollup is
188x faster than rollup with terser. Surely it is doing less refinement though.
As in not written in JS or doing a different process?
Not written in JS - the older generation of tools like babel and rollup are implemented in JS and are much slower than something that's implemeted in Go or Rust like esbuild or swc