I'm looking to switch from ts-loader
to esbuild-loader
in webpack to improve build times / watch compile times.
In our project, we use various type delceration files .d.ts
to load types/interfaces etc. However running the esbuild-loader
get a bunch of errors around them like....
Module not found: Error: Can't resolve '../../../../../../interfaces/some-d-ts-file' in 'some-tsx-file.tsx'
Specifically in the code complaining about this...
import { SomeInterfaces } from "../../../../../../../modules/something/interfaces";
Which is an interface.d.ts
file
I believe it is due to this caveat in ESBuild ? https://esbuild.github.io/content-types/#no-type-system
Is there anyway to get around this? Does it require just removing all references to these .d.ts
files ? Is there some task/compiling I can do with TS prior to esbuild-loader to fix it or some options to avoid this?
In my webpack.config.js
I am loading the esbuild-loader like such...
{
test: /\.(ts|tsx)$/,
loader: "esbuild-loader",
exclude: /node_modules/,
options: {
target: "es6",
loader: "tsx"
}
},