folke / esbuild-runner

⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild
https://www.npmjs.com/package/esbuild-runner
Apache License 2.0
711 stars 24 forks source link

tslib required? #39

Open patlux opened 2 years ago

patlux commented 2 years ago

I have a build.ts which I run to compile my source files with esbuild. To run it I have a npm-run-script:

"compile": "node -r esbuild-runner/register build.ts",

We do not have tslib explicitly installed in our project. When running the above command we get the following error:

/Users/<project-folder>/node_modules/esbuild-runner/lib/esbuild.js:22
    externals = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], Object.keys((_a = pkg.dependencies) !== null && _a !== void 0 ? _a : {}), true), Object.keys((_b = pkg.devDependencies) !== null && _b !== void 0 ? _b : {}), true);

TypeError: (0 , tslib_1.__spreadArray) is not a function
    at Object.<anonymous> (/Users/<project-folder>/node_modules/esbuild-runner/lib/esbuild.js:22:70)

20211116-194635_Screenshot

If I add tslib explicitly to the project, the above command runs without any problems.