codecks-io / react-sticky-box

Sticky boxes for contents of all sizes
https://react-sticky-box.codecks.io/
ISC License
469 stars 44 forks source link

typeError when build in docker #90

Closed jessemoe closed 1 year ago

jessemoe commented 1 year ago

This error only appeared in Docker environment

TypeError: Cannot read properties of null (reading 'useState')
2023-05-17 18:22:51     at exports.useState (/app/node_modules/react/cjs/react.production.min.js:25:394)
2023-05-17 18:22:51     at useStickyBox (file:///app/node_modules/react-sticky-box/dist/index.js:239:27)
2023-05-17 18:22:51     at StickyBox (file:///app/node_modules/react-sticky-box/dist/index.js:252:15)
2023-05-17 18:22:51     at Ge (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:114:273)
2023-05-17 18:22:51     at Z (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
2023-05-17 18:22:51     at He (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:123:155)
2023-05-17 18:22:51     at Ge (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:115:215)
2023-05-17 18:22:51     at Z (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:120:91)
2023-05-17 18:22:51     at He (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:123:155)
2023-05-17 18:22:51     at Je (/app/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.production.min.js:122:100)
danielberndt commented 1 year ago

You need to provide more context. What are you using for bundling? As you can see here the required file doesn't do anything unusual when importing useState from react.

jessemoe commented 1 year ago

I use the umi.js only appeared in production environment