-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Resolved the '.css' file before '.tsx' #3608
Comments
This was because the 2 files are in |
@hyrious But in my project, |
You can write a custom plugin to manually resolve imports in that folder to prefer .tsx files. Example: var CustomResolvePlugin = {
name: 'custom-resolve',
setup({ onResolve }) {
// manually resolve files in node_modules/@pddg/mobile-bg-download-ui to prefer use the .tsx file
onResolve({ filter: /(?:)/ }, args => {
if (args.resolveDir.includes('node_modules/@pddg/mobile-bg-download-ui')) {
const p = path.join(args.resolveDir, args.path)
if (!path.extname(p)) {
for (const ext of ['.tsx', '.ts', '.js', '.css', '/index.tsx', '/index.ts', '/index.js', '/index.css']) {
const full = p + ext
if (fs.existsSync(full)) {
return { path: full }
}
}
}
}
})
}
} |
I think this might be the same as #3341. Just so you are aware, putting |
I got error like this:
In ApproximateScaleText, has two files , index.css, index.tsx, esbuild resolved the file that extension is '.css'.
The text was updated successfully, but these errors were encountered: