2021-01-03 03:38:07 +00:00
|
|
|
import React from 'react'
|
2022-06-15 12:54:40 +00:00
|
|
|
import ReactDOM from 'react-dom/client'
|
2021-01-03 03:38:07 +00:00
|
|
|
|
|
|
|
// #1302: The linked package has a different version of React in its deps
|
|
|
|
// and is itself optimized. Without `dedupe`, the linked package is optimized
|
|
|
|
// with a separate copy of React included, and results in runtime errors.
|
2022-12-04 09:20:45 +00:00
|
|
|
import { useCount } from '@vitejs/test-dep-linked-include/index.mjs'
|
2021-01-03 03:35:24 +00:00
|
|
|
|
|
|
|
function App() {
|
|
|
|
const [count, setCount] = useCount()
|
|
|
|
|
|
|
|
return React.createElement(
|
|
|
|
'button',
|
|
|
|
{
|
|
|
|
onClick() {
|
|
|
|
setCount(count + 1)
|
2022-12-04 07:19:06 +00:00
|
|
|
},
|
2021-01-03 03:35:24 +00:00
|
|
|
},
|
2022-12-04 07:19:06 +00:00
|
|
|
`count is ${count}`,
|
2021-01-03 03:35:24 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-06-15 12:54:40 +00:00
|
|
|
ReactDOM.createRoot(document.querySelector('.dedupe')).render(
|
2022-12-04 07:19:06 +00:00
|
|
|
React.createElement(App),
|
2022-06-15 12:54:40 +00:00
|
|
|
)
|