serverless-bundle
serverless-bundle copied to clipboard
sls deploy failed to remove code with layers integration
Hi, i am using this library with typescript. I have AWS layer according to the documentation for NodeJs and deployed to AWS layers. libs has
- moment library
- custom encryption library
- Table models
arn:aws:lambda:us-east-1:xxxxxxxxxxx:layer:libs:4
libs.zip └ nodejs/node_modules/libs
tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"target": "ES6",
"sourceMap": true,
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"paths": {
"/opt/nodejs/*": [
"node_modules/custom-libs"
]
}
}
}
custom-libs loaded as dev-dependencies in my package,json and ignored node_module in serverless.yml
package:
individually: false
patterns:
- '!node_modules/**'
- '!node_modules/custom-libs/**'
I have tried as per the documentation of serverless-bundle to skip custom-libs but after sls package, still i can see all the momentjs, custom-libs code
Example after sls package
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js
//! version : 2.29.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
;(function (global, factory) {
true ? module.exports = factory() :
undefined
}(this, (function () { 'use strict';
var hookCallback;
function hooks() {
return hookCallback.apply(null, arguments);
}
// This is done to register the method called with moment()
// without creating circular dependencies.
function setHookCallback(callback) {
hookCallback = callback;
}
package.json
{
"name": "serverless-typescript-starter",
"version": "0.1.0",
"description": "A TypeScript starter for Serverless Framework",
"main": "handler.js",
"scripts": {
"test": "serverless-bundle test",
"start": "sls offline start"
},
"author": "",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/AnomalyInnovations/serverless-typescript-starter.git"
},
"devDependencies": {
"custom-libs": "file:../../aws-api/layers/libs/dist/nodejs/node_modules/libs",
"@types/aws-lambda": "^8.10.77",
"@types/jest": "^26.0.23",
"serverless-bundle": "^4.3.1",
"serverless-dotenv-plugin": "^3.9.0",
"serverless-offline": "^6.9.0"
},
"dependencies": {}
}