-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parcel production builds can't bundle the latest version #1475
Comments
Thanks for reporting! Do you have any guess what causes the issue? |
Can you please modify the last line to this and see how it goes? if (exports.default) { Object.assign(exports.default, exports); module.exports = exports.default; } |
Okay, manually edited the bundled file and this seems to fix the error. Edit: Or even directly editing the source file from zustand with the above changes removes the error from production bundles. |
@barelyhuman Do you have other ideas? |
i could do a empty assign check similar to the above solution but then that's just boiler code I expect bundlers to add. Let me play around with rollup a bit, i should be able to get a cleaner solution |
After hacking around, I think if we slowly let people used named imports instead that would be a good solution in the long run. for now , if I change the export * from './vanilla'
export * from './react'
export { default as createStore } from './vanilla'
import create from './react'
export { create }
/**
* @deprecated
*/
export default create |
We could add a named export and deprecate the default export for v5, but not sure what @drcmda would think. What's the issue with the hack? In the long run, I believe tools migrate to native ESM, so this issue will be less likely to happen. Can you also check what I do in proxy-memoize? Does it help in our case? |
The No direct issue with using a hack, it's just that we are running in circles with the export thing. We've got enough configuration to compile 10 libraries in the codebase which means more moving parts and harder to control what's going on, plus with the name and direct Hence, the recommendation to do the slow removal of the default export. I understand the aesthetic value of import create from "zustand" so I'd like to make it work in most cases, going throught older React bundling techniques where both the import styled worked. const React = require("react");
//and
import React from 'react' Even when there were almost 6-7 other named exports on the library. React = react
React.Children = Children
exports = React
exports.default = React
exports.Children = Children But I'd like to go through it a little more before I implement it here |
I just want to confirm that I have the same issue with 4.1.5 release. 4.1.4 is ok. |
…ist fixes the demo for now! Stay tuned: pmndrs/zustand#1475
I am still having this issue with |
Do you mean the reproduction in OP is failing with 4.3.2? It should have fixed before. |
Hey, I also encountered a new bug in my production build after updating to 4.3.2. To test this I updated my reproduction to [email protected] and to use named exports (https://github.com/nicobohne/zustand-parcel-reproduction/tree/update/4.3.2). I can confirm that there is a new error. This time the error is as follows:
I also tested [email protected]. No error occurs in this version. So I guess this error is related to #1531? Should I open a new issue for this error? |
Oh, really... Yeah, please open a new issue. |
Done: #1563 P.S.: Thx for this fantastic library |
Summary
The latest version of Zustand is not compatible with Parcel's builds. The following error is thrown when the bundled code is run:
Link to reproduction
https://github.com/nicobohne/zustand-parcel-reproduction
Check List
Please do not ask questions in issues.
Please fill this template if you're filling an issue regarding TypeScript.
create
is to be used ascreate<T>()(...)
and notcreate<T>(...)
.The text was updated successfully, but these errors were encountered: