lambda bundling with esbuild #188
-
Not sure if it is related to typedorm but I'm unable to bundle typedorm with esbuild so that it works with aws lambda. I'm using https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html to bundle the respective lambda. As I deployed the lambda it fails with the following message.
As far as I can see the result of the bundling only contains the entry files but no further modules are imported: ....
// node_modules/@typedorm/common/index.js
var require_common = __commonJS({
"node_modules/@typedorm/common/index.js"(exports, module2) {
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
for (var p in m)
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
__createBinding(exports2, m, p);
};
(function(factory) {
if (typeof module2 === "object" && typeof module2.exports === "object") {
var v = factory(require, exports);
if (v !== void 0)
module2.exports = v;
} else if (typeof define === "function" && define.amd) {
define("@typedorm/common", ["require", "exports", "@typedorm/common/public-api", "@typedorm/common/private-api"], factory);
}
})(function(require2, exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
__exportStar(require2("@typedorm/common/public-api"), exports2);
__exportStar(require2("@typedorm/common/private-api"), exports2);
});
}
});
// node_modules/@typedorm/core/index.js
var require_core = __commonJS({
"node_modules/@typedorm/core/index.js"(exports, module2) {
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
for (var p in m)
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
__createBinding(exports2, m, p);
};
(function(factory) {
if (typeof module2 === "object" && typeof module2.exports === "object") {
var v = factory(require, exports);
if (v !== void 0)
module2.exports = v;
} else if (typeof define === "function" && define.amd) {
define("@typedorm/core", ["require", "exports", "@typedorm/core/public-api", "@typedorm/core/private-api"], factory);
}
})(function(require2, exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
__exportStar(require2("@typedorm/core/public-api"), exports2);
__exportStar(require2("@typedorm/core/private-api"), exports2);
});
}
});
.... I'm not really familiar with esbuild. Did anyone has experience with bundling with esbuild? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@obiwabrakenobi There is a known issue open to doing with If not, are you able to set up a repro running in AWS sam, so I can replicate it locally and can help from there? |
Beta Was this translation helpful? Give feedback.
-
Hmm not sure. In our setup we build tsc to js first and only use esbuild for packaging everything into one file. I'll try to build some small repoducer |
Beta Was this translation helpful? Give feedback.
Hmm not sure. In our setup we build tsc to js first and only use esbuild for packaging everything into one file. I'll try to build some small repoducer