Shallow import issue on React Native #2127
-
SummaryHi, while installing zustand in a React Native app and calling shallow it will throw a warn even when it's NOT imported as default. import { shallow } from 'zustand/shallow'
shallow() WARN [DEPRECATED] Default export is deprecated. Instead use `import { shallow } from 'zustand/shallow'`. This doesn't happen in zustand 4.3.1 the issue seems to be in the way the code was compiled. Check on npm the last lines in exports.default = shallow;
exports.shallow = shallow$1;
module.exports = shallow$1;
module.exports.shallow = shallow;
exports.default = module.exports; by changing it for this it works well exports.default = shallow;
exports.shallow = shallow$1;
module.exports = shallow$1;
module.exports.shallow = shallow$1; // <-- change here
exports.default = module.exports; Link to reproductionhttps://github.com/glitch-txs/zustand-rn-warn/blob/main/App.tsx |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@glitch-txs weird, there's no warnings -> https://codesandbox.io/p/sandbox/magical-star-f7r88x?file=%2Fsrc%2FApp.tsx%3A7%2C1 |
Beta Was this translation helpful? Give feedback.
-
Oops, look like some recent change broke our manual patching... |
Beta Was this translation helpful? Give feedback.
#2128 should fix it.
https://ci.codesandbox.io/status/pmndrs/zustand/pr/2128
Please try "Local Install Instructions" ☝️