diff --git a/app.tsx b/app.tsx index 24cb891..b8a4712 100644 --- a/app.tsx +++ b/app.tsx @@ -1,8 +1,5 @@ -import ReactDOM from "react-dom/client"; import React from "react"; - - export function App(){ const [countGet, countSet] = React.useState(2); @@ -17,9 +14,7 @@ export const Other =()=>{ return

other app component

} -export function Root() +export default function Root() { return

rooted

} - -ReactDOM.createRoot(document.body).render(); \ No newline at end of file diff --git a/hmr/hmr-static.tsx b/hmr/hmr-static.tsx index f4e73e5..6c25c3f 100644 --- a/hmr/hmr-static.tsx +++ b/hmr/hmr-static.tsx @@ -64,11 +64,11 @@ const findNextExport =(inFile:string, inIndex=0, inLocal:Array, inForeig } else { - const members = inFile.substring(nextCharInd+1, endBracketInd).replace(/\s/g, ''); + const members = inFile.substring(nextCharInd+1, endBracketInd); members.split(",").forEach(part=> { 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(` -// // export in comment -// export * from "react"; -// const fakeexport =()=>{}; -// export{ thing1 as remapped, thing2} -// export { thing1 as remapped, thing2} from 'React'; -// export -// export const func=()=>{}; -// `); -// -// console.log(local, global); \ No newline at end of file +/////////////////////////////////////////////// +const [local, global] = ModuleShape(` +// export in comment +export { A as B } +export * from "react"; +const fakeexport =()=>{}; +export{ thing1 as remapped, thing2} +export { thing1 as remapped, thing2} from 'React'; +export +export const func=()=>{}; +`); + +console.log(local); \ No newline at end of file diff --git a/index.html b/index.html index 07fe9d7..d0b3eb4 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,11 @@ Document - + \ No newline at end of file