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

esbuild-plugin-alias

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-alias

esbuild plugin for path aliases

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
increased by1.98%
Maintainers
1
Weekly downloads
 
Created

What is esbuild-plugin-alias?

The esbuild-plugin-alias package is a plugin for esbuild, a fast JavaScript bundler and minifier. This plugin allows users to configure custom path aliases for modules in their project, which can simplify imports and make them more readable. It can also be used to mock modules or bind to specific versions of a module.

What are esbuild-plugin-alias's main functionalities?

Path Aliasing

This feature allows you to replace module paths with aliases. In the code sample, 'react' and 'react-dom' are aliased to 'preact/compat', which means that anywhere 'react' or 'react-dom' are imported, 'preact/compat' will be used instead.

require('esbuild').build({
  entryPoints: ['app.js'],
  bundle: true,
  outfile: 'out.js',
  plugins: [
    require('esbuild-plugin-alias')({
      react: require.resolve('preact/compat'),
      'react-dom': require.resolve('preact/compat')
    })
  ]
});

Directory Aliasing

This feature allows you to create aliases for directories. In the code sample, 'components' and 'utils' are aliases for the './src/components' and './src/utils' directories, respectively. This makes importing from these directories shorter and cleaner.

require('esbuild').build({
  entryPoints: ['app.js'],
  bundle: true,
  outfile: 'out.js',
  plugins: [
    require('esbuild-plugin-alias')({
      components: './src/components',
      utils: './src/utils'
    })
  ]
});

Other packages similar to esbuild-plugin-alias

Keywords

FAQs

Package last updated on 11 Nov 2021

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