vite-plugin-turbowarp-packager
v0.1.2
Published
A Vite plugin that uses `@turbowarp/packager` to generate TurboWarp-ready HTML from a `.sb3` file. During build, it outputs `dist/turbowarp-packager.html`.
Readme
vite-plugin-turbowarp-packager
A Vite plugin that uses @turbowarp/packager to generate TurboWarp-ready HTML from a .sb3 file.
During build, it outputs dist/turbowarp-packager.html.
Installation
bun add -D vite-plugin-turbowarp-packagerUsage
Use with hikkaku/vite (recommended)
The hikkaku plugin automatically sets the output path for project.sb3.
import hikkaku from 'hikkaku/vite'
import { defineConfig } from 'vite-plus'
import { pluginTurbowarpPackager } from 'vite-plugin-turbowarp-packager'
export default defineConfig({
plugins: [
hikkaku({
entry: 'src.ts',
}),
pluginTurbowarpPackager(),
],
})When using both plugins, place hikkaku(...) before pluginTurbowarpPackager(...).
Set sb3Entry manually
If your .sb3 is generated by another process, set sb3Entry directly.
import { defineConfig } from 'vite-plus'
import { pluginTurbowarpPackager } from 'vite-plugin-turbowarp-packager'
export default defineConfig({
plugins: [
pluginTurbowarpPackager({
sb3Entry: 'dist/project.sb3',
packagerOptions: {
turbo: true,
},
}),
],
})Options
interface TurbowarpPackagerOptions {
sb3Entry?: string
packagerOptions?: Partial<PackagerOptions>
}sb3Entry: Path to the.sb3file to package. Build fails if omitted.packagerOptions: Options passed to@turbowarp/packager.
Limitations
packagerOptions.targetcurrently supports onlyhtml.- Output filename is fixed to
turbowarp-packager.html. - This plugin is intended for build-time packaging (not dev-server conversion).
