Basic Lua Bundler |
---|
No Tree Shaking |
No fancy shit |
Just bundles your code |
Blazingly Fast (Build times are just a handful of milliseconds) |
MIT |
The best way to get started quickly with basic lua bundler is using create-blb: pnpm create blb
(or npm init blb
)
create-blb will guide you through the entire setup of blb automatically.
create-blb requires NodeJS >=18
Versions below Node 18 have not been tested.
- pnpm
- nodejs (preferably installed from
pnpm env use --global latest
) >= 18 - git
- Run
pnpm i -D blb
in your project - Make sure your project has a package.json
- Add this to your package.json's scripts:
"build": "blb-prod",
"dev": "blb-dev"
- Create a
src/index.lua
file. - Make sure you enter the
bundler
directory and runpnpm i
Note: Your entrypoint's parent dir is the only dir we look after. We do NOT bundle anything outside of it's parent dir.
Note 2: Only .lua files are bundled.
Note 3: you can require() directories if it has an index.lua inside.
command | description |
---|---|
build | builds into output/ |
dev | starts a dev server, builds on request |
You have some minimal variables available in your environment:
var | description | example |
---|---|---|
__filename | the file's name | in /src/a/b.lua : print(__filename) => a/b.lua |
__dirname | the directory's name | require(__dirname..'/test') |
__just_filename | Just the filename by itself | in /src/a/b.lua : print(__just_filename) => b.lua |
__hash | Hex hash of the file data | print(__hash) |
modules | internal list of modles, avoid using unless hotfixing shit | n / a |
Putting files in src/packages/ makes them require()able without the packages/ portion.