Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-esbuild

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-esbuild

Serverless plugin for zero-config JavaScript and TypeScript code bundling using extremely fast esbuild

  • 1.54.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
219K
increased by0.05%
Maintainers
1
Weekly downloads
 
Created

What is serverless-esbuild?

The serverless-esbuild npm package is a Serverless Framework plugin that allows you to use esbuild to bundle your JavaScript and TypeScript code. It is designed to optimize the deployment of serverless functions by providing fast and efficient builds.

What are serverless-esbuild's main functionalities?

Bundling JavaScript

This configuration demonstrates how to bundle a simple JavaScript function using esbuild. The 'bundle' option is set to true to enable bundling, and other options like 'minify', 'sourcemap', and 'target' are configured to optimize the build.

module.exports = {
  service: 'my-service',
  frameworkVersion: '2',
  plugins: ['serverless-esbuild'],
  provider: {
    name: 'aws',
    runtime: 'nodejs14.x'
  },
  functions: {
    hello: {
      handler: 'handler.hello'
    }
  },
  custom: {
    esbuild: {
      bundle: true,
      minify: false,
      sourcemap: true,
      target: 'node14',
      platform: 'node',
      external: ['aws-sdk']
    }
  }
};

Transpiling TypeScript

This configuration shows how to use esbuild to transpile TypeScript code. The 'tsconfig' option points to the TypeScript configuration file, enabling TypeScript support in the build process.

module.exports = {
  service: 'my-service',
  frameworkVersion: '2',
  plugins: ['serverless-esbuild'],
  provider: {
    name: 'aws',
    runtime: 'nodejs14.x'
  },
  functions: {
    hello: {
      handler: 'handler.hello'
    }
  },
  custom: {
    esbuild: {
      bundle: true,
      minify: false,
      sourcemap: true,
      target: 'node14',
      platform: 'node',
      external: ['aws-sdk'],
      tsconfig: 'tsconfig.json'
    }
  }
};

Including External Dependencies

This configuration demonstrates how to include external dependencies in the build process. The 'external' option specifies dependencies that should not be bundled, and the 'packager' option specifies the package manager to use.

module.exports = {
  service: 'my-service',
  frameworkVersion: '2',
  plugins: ['serverless-esbuild'],
  provider: {
    name: 'aws',
    runtime: 'nodejs14.x'
  },
  functions: {
    hello: {
      handler: 'handler.hello'
    }
  },
  custom: {
    esbuild: {
      bundle: true,
      minify: false,
      sourcemap: true,
      target: 'node14',
      platform: 'node',
      external: ['aws-sdk'],
      packager: 'yarn'
    }
  }
};

Other packages similar to serverless-esbuild

Keywords

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc