Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow performance when using external property #513

Open
elC0mpa opened this issue Dec 11, 2023 · 0 comments
Open

Slow performance when using external property #513

elC0mpa opened this issue Dec 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@elC0mpa
Copy link

elC0mpa commented Dec 11, 2023

Describe the bug
I just started using this plugin in my serverless project and after I started using esbuild-node-externals plugins it takes a long time (around 5 minutes) every time I exeute sls offline

To Reproduce

  1. My package,json file dependencies are the following ones:
  "dependencies": {
    "@aws-sdk/client-sns": "^3.425.0",
    "@middy/core": "^4.6.1",
    "@middy/http-error-handler": "^4.6.1",
    "@middy/http-event-normalizer": "^4.6.1",
    "@middy/http-json-body-parser": "^4.6.1",
    "@middy/validator": "^4.6.1",
    "dotenv": "^16.3.1",
    "http-errors": "^2.0.0",
    "lodash": "^4.17.21",
    "mongoose": "5.13.7",
    "redis": "^4.6.5",
    "telegraf": "^4.14.0",
    "wcwidth": "^1.0.1",
    "write-excel-file": "^1.4.27"
  },
  "devDependencies": {
    "@types/aws-lambda": "^8.10.119",
    "esbuild": "^0.19.9",
    "esbuild-node-externals": "^1.11.0",
    "husky": "^8.0.3",
    "prettier": "^3.0.3",
    "read-excel-file": "^5.6.1",
    "rimraf": "^5.0.1",
    "serverless-esbuild": "^1.50.0",
    "serverless-iam-roles-per-function": "^3.2.0",
    "serverless-offline": "^12.0.4",
    "ts-node": "^10.9.1",
    "tsc-alias": "^1.8.7",
    "typescript": "^5.2.2"
  }
  1. This is the content of my plugins file:
const { nodeExternalsPlugin } = require('esbuild-node-externals');

module.exports = [nodeExternalsPlugin()]
  1. This is my plugin configuration:
custom:
  esbuild:
    plugins: esbuild-plugins.js
  1. Execute sls offline

Expected behavior
I suppose I am doing something wrong because it takes around 5 minutes to launch the project, this happens after I added the esbuild-node-externals plugin

Versions (please complete the following information):

  • OS: Fedora 39
  • Serverless Framework Version: 3.35.2
  • Plugin Version: 1.50.0

Additional context
Just a question. Is it really necessary to declare all dependencies as external? I mean, initially when I didn't do it the project start pretty fast but it return some errors related to mongoose package. I supposed it was because it needed to be packaged as a node_modules dependency and that's why I decided to do it with the node-eternals-plugin

@elC0mpa elC0mpa added the bug Something isn't working label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant