fix hmr-static! misc

This commit is contained in:
Seth Trowbridge 2025-10-09 17:19:24 -04:00
parent 102f8a74d2
commit 93d953877e
3 changed files with 22 additions and 21 deletions

View File

@ -1,8 +1,5 @@
import ReactDOM from "react-dom/client";
import React from "react"; import React from "react";
export function App(){ export function App(){
const [countGet, countSet] = React.useState(2); const [countGet, countSet] = React.useState(2);
@ -17,9 +14,7 @@ export const Other =()=>{
return <p>other app component</p> return <p>other app component</p>
} }
export function Root() export default function Root()
{ {
return <div><h1>rooted</h1><App/><Other/></div> return <div><h1>rooted</h1><App/><Other/></div>
} }
ReactDOM.createRoot(document.body).render(<Root/>);

View File

@ -64,11 +64,11 @@ const findNextExport =(inFile:string, inIndex=0, inLocal:Array<string>, inForeig
} }
else else
{ {
const members = inFile.substring(nextCharInd+1, endBracketInd).replace(/\s/g, ''); const members = inFile.substring(nextCharInd+1, endBracketInd);
members.split(",").forEach(part=> members.split(",").forEach(part=>
{ {
const renamed = part.split(" as "); const renamed = part.split(" as ");
inLocal.push(renamed[1] || renamed[0]); inLocal.push((renamed[1] || renamed[0]).replace(/\s/g, ''));
}); });
} }
@ -130,15 +130,16 @@ ${ foreign.join(";\n") }`;
}; };
// /////////////////////////////////////////////// ///////////////////////////////////////////////
// const [local, global] = Exports(` const [local, global] = ModuleShape(`
// // export in comment // export in comment
// export * from "react"; export { A as B }
// const fakeexport =()=>{}; export * from "react";
// export{ thing1 as remapped, thing2} const fakeexport =()=>{};
// export { thing1 as remapped, thing2} from 'React'; export{ thing1 as remapped, thing2}
// export export { thing1 as remapped, thing2} from 'React';
// export const func=()=>{}; export
// `); export const func=()=>{};
// `);
// console.log(local, global);
console.log(local);

View File

@ -5,6 +5,11 @@
<title>Document</title> <title>Document</title>
</head> </head>
<body> <body>
<script type="module" src="/app.tsx"></script> <script type="module">
import ReactDOM from "react-dom/client";
import React from "react";
import App from "/app.tsx";
ReactDOM.createRoot(document.body).render(React.createElement(App));
</script>
</body> </body>
</html> </html>