Open melMass opened 2 years ago
Here is a simplified repro (removed some test case) (there is scroll):
const suffix_re = /^(export|import)((\s|\w|\*|{|,)*(})?.*)(from)(.*)("|')(\.\/(\w|\s|\/)*((?!\.js).)*)("|')(;)?/gm
const suffixLoad = async (
{
path,
// namespace,
// suffix,
// pluginData
}: OnLoadArgs
): Promise<OnLoadResult> => {
const contents = await readFile(path, 'utf-8');
const new_val = contents.replaceAll(suffix_re, "$1$2$3$5$6$7$8.js$10$11$12")
return {
pluginName: "suffix-js",
loader: "ts",
contents: new_val
}
}
export const suffixJS: Plugin = {
name: "suffix-js",
setup(build) {
build.onLoad({ filter: /ts$/ }, suffixLoad)
}
}
Seems like if tsup was updating typescript to 4.7+ this workaround would not be needed anymore (not really related to the issue but still relevant I guess)
Did you manage to get this issue solved? The ts in this repo is 5+ now but the issue still exists for me. the onLoad
function in esbuild plugin never called.
edit: also related #888
edit: I found the issue. In my case it was the esbuild-sass-plugin having conflicts with the built-in postcss plugin. You can turn the built-in one off to solve.
Hi,
I'm using tsup for a library and I really like the simplicity. I want to use an esbuild plugin I wrote to append ".js" or "index.js" on required imports. To be sure I tested it in plain esbuild and it works well, but not in tsup for some reason.
The
setup
method is properly ran, but not the onLoad callback (its never called).Is this a know issue? If not how would you debug it ?
Thanks
Upvote & Fund