esbuild-node-externals icon indicating copy to clipboard operation
esbuild-node-externals copied to clipboard

Potential bug with allowList

Open janstuemmel opened this issue 4 years ago • 0 comments

Hi :)

I found a potential bug in the plugin's onResolve hook. When i have a scoped package in my allowList like @myrepo/foobar and want to import a subpath of it @myrepo/foobar/logging the plugin would ignore bundling of the package and set external: true for the package.

https://github.com/pradel/esbuild-node-externals/blob/cf3d1f188b6033290a5c00e97f1a05d318c7d8cd/esbuild-node-externals/src/index.ts#L44

Example:

// in plugin
esbuild.build({
  // ...
  plugins: [nodeExternalsPlugin({
    allowList: ['@myrepo/foobar']
  })],
});

// in code
import logging from '@myrepo/foobar/logging'

Outcome: The plugin would mark @myrepo/foobar as external. Expected: The plugin would NOT mark @myrepo/foobar as external

Thanks for the lib btw :)

janstuemmel avatar Nov 18 '21 10:11 janstuemmel