Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Change where a module dependency is resolved/imported from.

License

Notifications You must be signed in to change notification settings

markwylde/esbuild-plugin-resolve

Repository files navigation

esbuild-plugin-resolve

Change where a module dependency is resolved/imported from.

Installation

npm i --save-dev esbuild-plugin-resolve

Usage

import esbuild from 'esbuild';
import resolve from 'esbuild-plugin-resolve';

esbuild.build({
  entryPoints: ['./src/index.js'],
  bundle: true,
  outfile: './lib/index.js',
  plugins: [resolve({
    test: 'test-two/lib/example'
  })]
});

// The following will be rewritten
import test from 'test'
import test from 'test-two/lib/example'