favware / esbuild-plugin-file-path-extensions

An esbuild plugin to automatically insert file extensions in your built JavaScript files based on the specified target
MIT License
21 stars 2 forks source link

bug: not applied when `bundle: false` is used with `tsup` #44

Closed shellscape closed 1 year ago

shellscape commented 1 year ago

Is there an existing issue for this?

Description of the bug

When bundle: false is specified for tsup options, this plugin isn't applied. I'm not sure this is a bug with the plugin itself, or if this is default behavior by tsup when bundling is disabled (e.g. it doesn't use esbuild).

Steps To Reproduce

Here's a config that demonstrates the issue:

import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions';
import { defineConfig } from 'tsup';

export default defineConfig({
  // bundle: false,
  clean: true,
  dts: true,
  entry: ['src/*.ts', 'src/*.tsx'],
  esbuildPlugins: [esbuildPluginFilePathExtensions({ esmExtension: 'js' })],
  format: ['cjs', 'esm'],
  // keepNames: true,
  outDir: 'dist',
  // skipNodeModulesBundle: true,
  sourcemap: true,
  target: ['es2022', 'node18']
});

Expected behavior

I would expect the plugin to apply the file extensions, but again that may not be an issue with this plugin. Feel free to nuke this from orbit if it's not something concerned with this plugin.

Screenshots

No response

Additional context

No response

shellscape commented 1 year ago

Looks like this may not be the fault of tsup or this plugin https://github.com/egoist/tsup/issues/729#issuecomment-1301602405

favna commented 1 year ago

The readme of this package also instructs to use bundle: true when using tsup so I'm closing this and I'll just say: RTM

shellscape commented 1 year ago

Missed that, thanks!