-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tsconfig.json support? #70
Comments
found a workaround using @rollup/plugin-alias import path from "path";
import resolve from "rollup-plugin-node-resolve";
import esbuild from "rollup-plugin-esbuild";
import alias from "@rollup/plugin-alias";
const projectRootDir = path.resolve(__dirname);
export default {
/**/
plugins: [
alias({
customResolver: resolve({ extensions: [".tsx", ".ts"] }),
entries: Object.entries({
"::helpers/*": ["./src/helpers/*"],
"::hooks/*": ["./src/hooks/*"]
/**/
}).map(([alias, value]) => ({
find: new RegExp(`${alias.replace("/*", "")}`),
replacement: path.resolve(
projectRootDir,
`${value[0].replace("/*", "")}`
)
}))
}),
esbuild({
/**/
})
]
}; |
The solution is to use |
Thanks for the mention @egoist |
@peats-bond path alias is not part of esbuild's |
I couldn't get the newer @rollup/plugin-node-resolve to work as the import alias, { type ResolverFunction } from '@rollup/plugin-alias'
function resolveExtensions(extensions: string[]): ResolverFunction {
return async function (source) {
for (const extension of extensions) {
try {
const moduleInfo = await this.load({ id: source + extension })
return moduleInfo.id
} catch {}
}
return null
}
}
alias({
customResolver: resolveExtensions(['.ts']),
entries: [/* ... */]
}) |
See #70 (comment), and let's track evanw/esbuild#394. As this project is a wrapper of esbuild. |
Notice that besides Some people are using the later because it's more generic (at least when we know that source code will always be transformed), but |
Hi there!
Thanks for the helpful plugin!
I'm trying to integrate esbuild into rollup using your plugin and it seems that it doesn't support tsconfig.json completely?
At least it doesn't respect
compilerOptions.baseUrl
andcompilerOptions.paths
.These are path aliases which allow to write
instead of
(well, I think you know, but just for clarity :) )
And as far as I know esbuild itself supports these options (evanw/esbuild#60 and evanw/esbuild#38 (comment)).
Or maybe I missed something?
The text was updated successfully, but these errors were encountered: