Skip to content

Minimal bundle luaLibImport option#1383

Merged
Perryvw merged 6 commits intoTypeScriptToLua:masterfrom
GlassBricks:minimal-lualib_bundle
Jan 15, 2023
Merged

Minimal bundle luaLibImport option#1383
Perryvw merged 6 commits intoTypeScriptToLua:masterfrom
GlassBricks:minimal-lualib_bundle

Conversation

@GlassBricks
Copy link
Copy Markdown
Contributor

This adds the option "require-minimal" to luaLibImport.
With this, the emitted lualib_bundle.lua only contains used features.

This does a text search on all resolved (lua) files to determine which lualib features were used, so that projects which import lua libraries using lualib features still work.

@Zamiell
Copy link
Copy Markdown
Contributor

Zamiell commented Jan 13, 2023

is it expensive? if not, then should we have it turned on unconditionally?

@Perryvw
Copy link
Copy Markdown
Member

Perryvw commented Jan 14, 2023

is it expensive? if not, then should we have it turned on unconditionally?

Omitting part of the lualib has a higher chance of breaking things and causing runtime errors, especially with external Lua. Maybe after a while we can make this the default, but for now I think this is correct as opt-in.

src/LuaLib.ts Outdated
emitHost: EmitHost,
exportName: string
): LuaLibFeature | undefined {
const luaLibPath = resolveLuaLibDir(luaTarget);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this always the same within a project? Does this actually do anything?

@Perryvw Perryvw merged commit d315218 into TypeScriptToLua:master Jan 15, 2023
@Zamiell
Copy link
Copy Markdown
Contributor

Zamiell commented Jan 28, 2023

@GlassBricks It needs to be added to the webpage too: https://typescripttolua.github.io/docs/configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants