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

@chialab/esbuild-plugin-alias

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chialab/esbuild-plugin-alias

A plugin for esbuild that resolves aliases or empty modules.

  • 0.17.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
85
increased by28.79%
Maintainers
2
Weekly downloads
 
Created
Source

Esbuild Plugin Alias • A plugin for esbuild that resolves aliases or empty modules.

NPM


Install

$ npm i @chialab/esbuild-plugin-alias -D
$ yarn add @chialab/esbuild-plugin-alias -D

Usage

Load path-browser.js instead of the node's path module:

import esbuild from 'esbuild';
import aliasPlugin from '@chialab/esbuild-plugin-alias';

await esbuild.build({
    plugins: [
        aliasPlugin({
            'node-fetch': false,
            'path': '../path-browser.js'
        }),
    ],
});

Load node-fetch module as an empty module:

import esbuild from 'esbuild';
import aliasPlugin from '@chialab/esbuild-plugin-alias';

await esbuild.build({
    plugins: [
        aliasPlugin({
            'node-fetch': false,
        }),
    ],
});

Load aliases from browser field in package.json:

package.json

{
    "name": "webapp",
    "version": "0.0.0",
    "browser": {
        "path": "./browser-path.js",
        "node-fetch": false,
    }
}
import esbuild from 'esbuild';
import aliasPlugin from '@chialab/esbuild-plugin-alias';

await esbuild.build({
    platform: 'browser',
    plugins: [
        aliasPlugin(),
    ],
});

License

Esbuild Plugin alias is released under the MIT license.

Keywords

FAQs

Package last updated on 13 Dec 2022

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