trans.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Fragment, jsxDEV } from 'react/jsx-dev-runtime'
  2. import RefreshRuntime from '/@react-refresh'
  3. const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope
  4. let prevRefreshReg
  5. let prevRefreshSig
  6. if (import.meta.hot && !inWebWorker) {
  7. if (!window.__vite_plugin_react_preamble_installed__) {
  8. throw new Error('@vitejs/plugin-react can\'t detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201')
  9. }
  10. prevRefreshReg = window.$RefreshReg$
  11. prevRefreshSig = window.$RefreshSig$
  12. window.$RefreshReg$ = (type, id) => {
  13. RefreshRuntime.register(type, '/Users/huangzhichao/Documents/www/test/pro_demo/react_vite/src/App.tsx ' + id)
  14. }
  15. window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform
  16. }
  17. var _s = $RefreshSig$()
  18. import { useState } from 'react'
  19. import './App.css'
  20. function App() {
  21. _s()
  22. const [count, setCount] = useState(0)
  23. return /* @__PURE__ */jsxDEV(Fragment, {
  24. children: /* @__PURE__ */jsxDEV('div', {
  25. className: 'container',
  26. children: ['123', /* @__PURE__ */jsxDEV('div', {
  27. children: 'span'
  28. }, void 0, false, {
  29. fileName: '/Users/huangzhichao/Documents/www/test/pro_demo/react_vite/src/App.tsx',
  30. lineNumber: 11,
  31. columnNumber: 9
  32. }, this)]
  33. }, void 0, true, {
  34. fileName: '/Users/huangzhichao/Documents/www/test/pro_demo/react_vite/src/App.tsx',
  35. lineNumber: 8,
  36. columnNumber: 7
  37. }, this)
  38. }, void 0, false, {
  39. fileName: '/Users/huangzhichao/Documents/www/test/pro_demo/react_vite/src/App.tsx',
  40. lineNumber: 7,
  41. columnNumber: 10
  42. }, this)
  43. }
  44. _s(App, 'oDgYfYHkD9Wkv4hrAPCkI/ev3YU=')
  45. _c = App
  46. export default App
  47. var _c
  48. $RefreshReg$(_c, 'App')
  49. if (import.meta.hot && !inWebWorker) {
  50. window.$RefreshReg$ = prevRefreshReg
  51. window.$RefreshSig$ = prevRefreshSig
  52. RefreshRuntime.__hmr_import(import.meta.url).then(currentExports => {
  53. RefreshRuntime.registerExportsForReactRefresh('/Users/huangzhichao/Documents/www/test/pro_demo/react_vite/src/App.tsx', currentExports)
  54. import.meta.hot.accept(nextExports => {
  55. if (!nextExports) return
  56. const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(currentExports, nextExports)
  57. if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage)
  58. })
  59. })
  60. }