automatically add "react/"
This commit is contained in:
parent
3fed5dfdba
commit
c3e5319d47
@ -7,7 +7,7 @@
|
|||||||
{
|
{
|
||||||
"react":"https://esm.sh/preact@10.15.1/compat",
|
"react":"https://esm.sh/preact@10.15.1/compat",
|
||||||
"react-original":"https://esm.sh/preact@10.15.1/compat",
|
"react-original":"https://esm.sh/preact@10.15.1/compat",
|
||||||
"@able/": "./"
|
"able/": "http://localhost:1234/"
|
||||||
},
|
},
|
||||||
"tasks":
|
"tasks":
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { Router, Switch, Case } from "able/iso-elements.tsx";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const CTXString = React.createContext("lol");
|
const CTXString = React.createContext("lol");
|
||||||
@ -35,9 +37,10 @@ export default ()=>
|
|||||||
{
|
{
|
||||||
const [Store, Dispatch] = React.useReducer(reducer, {name:"seth", age:24} as Store, builder)
|
const [Store, Dispatch] = React.useReducer(reducer, {name:"seth", age:24} as Store, builder)
|
||||||
return <CTXString.Provider value="intradestink">
|
return <CTXString.Provider value="intradestink">
|
||||||
|
<Router.Provider>
|
||||||
<div class="my-4 font-sans">
|
<div class="my-4 font-sans">
|
||||||
<h1 class="font-black text-xl text-red-500">Title</h1>
|
<h1 class="font-black text-xl text-red-500">Title</h1>
|
||||||
<h2 class="font-black text-blue-500">subtitle</h2>
|
<h2 class="font-black text-blue-500 p-4">subtitle</h2>
|
||||||
<p>
|
<p>
|
||||||
<button onClick={e=>Dispatch(1)}>{Store.name}|{Store.age}?</button>
|
<button onClick={e=>Dispatch(1)}>{Store.name}|{Store.age}?</button>
|
||||||
</p>
|
</p>
|
||||||
@ -48,5 +51,6 @@ export default ()=>
|
|||||||
<Outer>
|
<Outer>
|
||||||
<Inner/>
|
<Inner/>
|
||||||
</Outer>
|
</Outer>
|
||||||
|
</Router.Provider>
|
||||||
</CTXString.Provider>;
|
</CTXString.Provider>;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"imports":
|
"imports":
|
||||||
{
|
{
|
||||||
"react": "https://esm.sh/preact@10.15.1/compat",
|
"react": "https://esm.sh/preact@10.15.1/compat",
|
||||||
|
"able/": "http://localhost:1234/",
|
||||||
"entry": "./app.tsx"
|
"entry": "./app.tsx"
|
||||||
},
|
},
|
||||||
"tasks":
|
"tasks":
|
||||||
|
@ -53,6 +53,10 @@ const ImportMapReload =async()=>
|
|||||||
{
|
{
|
||||||
console.log(`"react" specifier not defined in import map`);
|
console.log(`"react" specifier not defined in import map`);
|
||||||
}
|
}
|
||||||
|
else if(!json.imports["react/"])
|
||||||
|
{
|
||||||
|
json.imports["react/"] = json.imports["react"]+"/";
|
||||||
|
}
|
||||||
|
|
||||||
ImportMap.imports = Configuration.Remap(json.imports, Configuration);
|
ImportMap.imports = Configuration.Remap(json.imports, Configuration);
|
||||||
console.log(ImportMap.imports);
|
console.log(ImportMap.imports);
|
||||||
@ -70,12 +74,6 @@ let Configuration:Configuration =
|
|||||||
async Serve(inReq, inURL, inExt, inMap, inConfig){},
|
async Serve(inReq, inURL, inExt, inMap, inConfig){},
|
||||||
Remap: (inImports, inConfig)=>
|
Remap: (inImports, inConfig)=>
|
||||||
{
|
{
|
||||||
const reactURL = inImports["react"];
|
|
||||||
const setting = Configuration.SWCOp?.jsc?.transform?.react;
|
|
||||||
if(setting && reactURL)
|
|
||||||
{
|
|
||||||
setting.importSource = reactURL;
|
|
||||||
}
|
|
||||||
return inImports;
|
return inImports;
|
||||||
},
|
},
|
||||||
Shell(inReq, inURL, inExt, inMap, inConfig)
|
Shell(inReq, inURL, inExt, inMap, inConfig)
|
||||||
|
Loading…
Reference in New Issue
Block a user