File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ This simplified runtime architecture is inspired by [`solid-refresh`](https://gi
1212- By default, any change will cause components to remount and thus hook states are not preserved.
1313- Adding ` // @hmr-unsafe ` comment above the component definition will preserve hook states, but each hot update must keep same hook count.
1414- Each component will be wrapped with extra component ` (ComponentName)_refresh ` .
15+ - Changing constants outside of component defnition won't trigger refresh since ` Function.toString ` is used to detect change.
1516
1617## usages
1718
Original file line number Diff line number Diff line change 11{
22 "name" : " @hiogawa/tiny-refresh" ,
3- "version" : " 0.0.1-pre.8 " ,
3+ "version" : " 0.0.1-pre.9 " ,
44 "homepage" : " https://github.com/hi-ogawa/js-utils/tree/main/packages/tiny-refresh" ,
55 "repository" : {
66 "type" : " git" ,
Original file line number Diff line number Diff line change 11export * from "./runtime" ;
2- export * from "./transform" ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export function hmrTransform(
1717 const extraCodes : string [ ] = [ ] ;
1818
1919 for ( let i = 0 ; i < lines . length ; i ++ ) {
20- const prevLine = lines [ i - 1 ] || "" ; // TODO: it should be "??" but it breaks old webpack.
20+ const prevLine = lines [ i - 1 ] ?? "" ;
2121 const line = lines [ i ] ;
2222 // disable per file
2323 if ( line . startsWith ( "// @hmr-disable-all" ) ) {
@@ -53,8 +53,8 @@ export function hmrTransform(
5353 return [
5454 headerCode (
5555 options . runtime ,
56- options . refreshRuntime || "@hiogawa/tiny-refresh" ,
57- options . debug || false
56+ options . refreshRuntime ?? "@hiogawa/tiny-refresh" ,
57+ options . debug ?? false
5858 ) ,
5959 ...newLines ,
6060 ...extraCodes ,
You can’t perform that action at this time.
0 commit comments