-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
lineNumber error for __source prop #235
lineNumber error for __source prop #235
Comments
The issue: Since vitejs/vite#9590 the pipeline is:
The issue is that the first transform drop some line breaks, which then make esbuild put the wrong line number. To avoid this, the fast refresh transformation should be done at the same time than fast refresh:
export default defineConfig(({ mode }) => {
return {
plugins: [
react({
babel: {
plugins:
mode === 'development'
? ['@babel/plugin-transform-react-jsx-development']
: undefined,
},
}),
],
};
}); Why this second option is not the default? |
I tried to configure retainLines for babel, and it seems to work for now. export default defineConfig({
plugins: [
react({
babel: {
retainLines: isDev,
},
}),
],
}); |
Oh nice, I will test which one has the more impact on the dev startup time. plugins: [
react({
babel: mode === 'development' ? {
plugins: ['@babel/plugin-transform-react-jsx-development']
} : undefined,
}),
], |
Describe the bug
In development, lineNumber for the __source prop provided by babel-plugin-transform-react-jsx-source is wrong.
I have solved this issue locally and I can submit a pr for this issue.
Reproduction
https://stackblitz.com/edit/vitejs-vite-nje3zq?file=src%2FApp.tsx&terminal=dev
Steps to reproduce
Wait for the project to run automatically to see the requests from App.tsx
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: