File tree 7 files changed +364
-818
lines changed
7 files changed +364
-818
lines changed Original file line number Diff line number Diff line change 38
38
},
39
39
"homepage" : " https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme" ,
40
40
"dependencies" : {
41
- "@babel/core" : " ^7.25.2 " ,
41
+ "@babel/core" : " ^7.26.0 " ,
42
42
"@babel/plugin-transform-react-jsx-self" : " ^7.24.7" ,
43
43
"@babel/plugin-transform-react-jsx-source" : " ^7.24.7" ,
44
44
"@types/babel__core" : " ^7.20.5" ,
Original file line number Diff line number Diff line change @@ -249,6 +249,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
249
249
} ,
250
250
generatorOpts : {
251
251
...babelOptions . generatorOpts ,
252
+ // import attributes parsing available without plugin since 7.26
253
+ importAttributesKeyword : 'with' ,
252
254
decoratorsBeforeExport : true ,
253
255
} ,
254
256
plugins,
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import Parent from './hmr/parent'
5
5
import { JsxImportRuntime } from './hmr/jsx-import-runtime'
6
6
import { CountProvider } from './context/CountProvider'
7
7
import { ContextButton } from './context/ContextButton'
8
+ import { TestImportAttributes } from './import-attributes/test'
8
9
9
10
function App ( ) {
10
11
const [ count , setCount ] = useState ( 0 )
@@ -40,6 +41,7 @@ function App() {
40
41
< Parent />
41
42
< JsxImportRuntime />
42
43
< Button > button</ Button >
44
+ < TestImportAttributes />
43
45
</ div >
44
46
)
45
47
}
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ test.runIf(isServe)(
69
69
} ,
70
70
)
71
71
72
+ test ( 'import attributes' , async ( ) => {
73
+ expect ( await page . textContent ( '.import-attributes' ) ) . toBe ( 'ok' )
74
+ } )
75
+
72
76
if ( ! isBuild ) {
73
77
// #9869
74
78
test ( 'should only hmr files with exported react components' , async ( ) => {
Original file line number Diff line number Diff line change
1
+ {
2
+ "message" : " ok"
3
+ }
Original file line number Diff line number Diff line change
1
+ import data from './data.json' with { type : 'json' }
2
+
3
+ export function TestImportAttributes ( ) {
4
+ return (
5
+ < div >
6
+ import-attirbutes: < span class = "import-attributes" > { data . message } </ span >
7
+ </ div >
8
+ )
9
+ }
You can’t perform that action at this time.
0 commit comments