Skip to content

Commit

Permalink
fix: enable retainLines to get correct line numbers for jsxDev (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre authored Oct 31, 2023
1 parent 05ef392 commit b783190
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Enable retainLines to get correct line numbers for jsxDev (fix [#235](https://github.com/vitejs/vite-plugin-react/issues/235))

## 4.1.0 (2023-09-24)

- Add `@types/babel__cores` to dependencies (fix [#211](https://github.com/vitejs/vite-plugin-react/issues/211))
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
root: projectRoot,
filename: id,
sourceFileName: filepath,
// Required for esbuild.jsxDev to provide correct line numbers
retainLines: !isProduction && isJSX && opts.jsxRuntime !== 'classic',
parserOpts: {
...babelOptions.parserOpts,
sourceType: 'module',
Expand Down

0 comments on commit b783190

Please sign in to comment.