Skip to content

Commit

Permalink
update for config webpack and install
Browse files Browse the repository at this point in the history
Need to put an alias entrypoint for inferno on webpack to this file 
  
resource.alias["react$"]=directoryPath(`./src/packinferno/inferno-compat`);
 resource.alias["react-dom"]=directoryPath(`./src/packinferno/inferno-compat`); 
resource.alias["inferno$"]=directoryPath(`./src/packinferno/xferno.js`);
  • Loading branch information
simonjoom authored Sep 28, 2022
1 parent f334cac commit 37a216f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/xferno.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Fragment, EMPTY_OBJ, createComponentVNode as createComponentVNodeo, createFragment, createPortal, createRef, createRenderer, createTextVNode, createVNode, forwardRef, directClone, findDOMfromVNode, getFlagsForElementVnode, linkEvent, normalizeProps, options, render, rerender, version,
// Internal methods, used by hydration
_CI, _HI, _M, _MCCC,_ME,_MFCC,_MR, _MP, __render, _RFC } from './infernopack';
_CI, _HI, _M, _MCCC,_ME,_MFCC,_MR, _MP, __render, _RFC } from './inferno-core';
//import { eq } from './eq';

import { VNodeFlags } from 'inferno-vnode-flags';
Expand Down

1 comment on commit 37a216f

@simonjoom
Copy link
Owner Author

@simonjoom simonjoom commented on 37a216f Apr 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this commit inferno-core is a folder who contain the original inferno source code
in webpack this file xferno,jsx has to be an alias to inferno

then
inferno-compat package alias react and also react-dom (well if you are not beginner you know that you need it for react)
inferno-compat use inferno in the code so it will take the new version with useeffects because the aliases

You need to export reference from inferno in inferno-compat if you want to have the new function accessible for your code like:

in inferno-compat/index.js


import { useRef,useState,useEffect,useMemo,useDispatch,useCallback,useReducer,useLayoutEffect, __render, _CI, _HI, _M, _MCCC, _ME, _MFCC, _MP, _MR, Component, createComponentVNode, createFragment, createPortal, createRef, createRenderer, createTextVNode, createVNode, directClone, EMPTY_OBJ, findDOMfromVNode, forwardRef, Fragment, getFlagsForElementVnode, linkEvent, normalizeProps, options, rerender } from 'inferno';

...

at the end
export {
    useRef,useState,useEffect,useMemo,useDispatch,useCallback,useReducer,useLayoutEffect, Children, Component, EMPTY_OBJ, Fragment, 
..
}

then You can use React.useRef ..etc

to clarify xferno.jsx extends inferno library and you use inferno-compat to plug all to react

Please sign in to comment.