In a brand new TSTL project, I import a helper function from an external Lua module from NPM:
import { foo } from "my-npm-module";
foo();
This compiles successfully but results in a runtime error:
module 'lualib_bundle' not found:
Upon inspecting the compiled Lua output, I find that there are N instances of the following line:
require("lualib_bundle");
However, there is no definition of lualib_bundle anywhere.
Realizing this, I manually tweak the TypeScript code in an effort to try to make TypeScriptToLua define it:
import { foo } from "my-npm-module";
foo();
// Force TSTL to include the definition for "concat" in the compiled output
const someArray = [];
someArray.concat();
Sure enough, this removes the runtime error.
So the problem is that TSTL isn't defining lualib_bundle in programs that only have external dependencies or whatever.
In a brand new TSTL project, I import a helper function from an external Lua module from NPM:
This compiles successfully but results in a runtime error:
Upon inspecting the compiled Lua output, I find that there are N instances of the following line:
However, there is no definition of lualib_bundle anywhere.
Realizing this, I manually tweak the TypeScript code in an effort to try to make TypeScriptToLua define it:
Sure enough, this removes the runtime error.
So the problem is that TSTL isn't defining lualib_bundle in programs that only have external dependencies or whatever.