Closed wildfrontend closed 4 years ago
this is my config code
commonjs({ include: 'node_modules/**', namedExports: { 'node_modules/react/index.js': [ 'Component', 'PureComponent', 'Fragment', 'Children', 'createElement', 'useContext', 'useEffect', 'useLayoutEffect', 'useMemo', 'useReducer', 'useRef', 'useState', ], 'node_modules/react-dom/index.js': ['unstable_batchedUpdates'], 'node_modules/react-is/index.js': [ 'isContextConsumer', 'isValidElementType', ], }, }),
if i add useCallback in common(namedExports:{ 'node_modules/react/index.js'}) rollup can build success but it will show useEffect is not defined
useCallback
useEffect is not defined
so my problem how do i exported useCallback
The problem is that react does not provide any detectable exports in commonjs entry point. Here's the solution. https://github.com/rollup/rollup-plugin-commonjs/issues/290#issuecomment-537683484
this is my config code
if i add
useCallback
in common(namedExports:{ 'node_modules/react/index.js'}) rollup can build success but it will showuseEffect is not defined
so my problem how do i exported
useCallback