import {validateEmail} from "/util/util.js";
When I try to bundle a js file containing many such imports, esbuild cannot resolve the path.
When opened in a browser, this resolves to {webroot}/util/utij.js, but when I try to bundle it on windows, esbuild looks for the file in the root of the C drive and fails to find the file.
Is there a way to set the path that would be used as root when resolving an absolute path?
I tried actually moving the project to the root of the drive and then it works, as well as changing the import to "../../util/util.js", but it would be easier if I could just set the root directory with a parameter.
The developer replied to me over on github.
The root directory can be set by creating a tsconfig.json and using the option --tsconfig="path to config". In the config file, you can remap the root path "/" to anything, including the current working directory.
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"/*": [
"./*" <------- Remap "/" to "./"
]
}
}
}