-
-
Notifications
You must be signed in to change notification settings - Fork 261
Closed
Labels
Description
I am writing a custom esbuild plugin for my project.
I have written something similar to the following:
// file: ./tsup.config.ts
import type { Options } from 'tsup'
import myPlugin from './plugins/myPlugin'
export const tsup: Options = {
// ...
esbuildPlugins: [
myPlugin()
]
}
// file: ./plugins/myPlugin.ts
import type { Plugin } from 'esbuild'
interface MyConfig {
// ...
}
export default (config?: MyConfig): Plugin => {
return {
name: 'my-plugin',
setup(build) {
// ...
}
}
}
This fails with:
Error: Cannot find module './plugins/myplugin'
Require stack:
- /path/to/myproject/tsup.config.ts
- /path/to/myproject/node_modules/tsup/dist/index.js
- /path/to/myproject/node_modules/tsup/dist/chunk-BNJB64XR.js
- /path/to/myproject/node_modules/tsup/dist/chunk-RVCHPLKK.js
- /path/to/myproject/node_modules/tsup/dist/cli-default.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/path/to/myproject/tsup.config.ts:3:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at requireFromString (/path/to/myproject/node_modules/tsup/dist/chunk-MHVTP22R.js:1983:5)
at Object.load (/path/to/myproject/node_modules/tsup/dist/chunk-MHVTP22R.js:2015:17)
at async JoyCon.load (/path/to/myproject/node_modules/joycon/lib/index.js:184:16)
at async loadTsupConfig (/path/to/myproject/node_modules/tsup/dist/chunk-MHVTP22R.js:2034:18)
If I write the plugin as a .js
file instead, there is no issue, but it looks like the JoyCon loader doesn't properly resolve importing other .ts
files