chakra-pro-issues icon indicating copy to clipboard operation
chakra-pro-issues copied to clipboard

Not able to install Chakra UI pro theme

Open aravind-eng opened this issue 3 years ago • 1 comments

Hello Team, I have just downloaded the blueberry pro theme and followed the instructions as mentioned in readme.

I am facing the following issue Screen Shot 2022-08-24 at 5 40 28 PM

Can you please check whether this is known issue?

We are using the following Charkra ui versions "@chakra-ui/pro-theme": "^0.0.53", "@chakra-ui/react": "^2.2.8", "@chakra-ui/theme-tools": "^2.0.10",

aravind-eng avatar Aug 25 '22 00:08 aravind-eng

  • I would recommend chakra devs should release a bundle version where the import is made without using named exports, as it may be a issue for some React frameworks.
  • But we can do this change by:
    • Cloning the repository;
    • Changing the file;
    • Releasing a new npm module deployed under our own user;
    • Installing our own package with our changes.
  • But as I don't wanna do this work, I've fixed by using patch-package (lazy solution):
    • Replaced the following lines of the file node_modules/@chakra-ui/pro-theme/dist/index.mjs :
      • line 20: import chakraReact from "@chakra-ui/react";
      • line 1051: const theme = chakraReact.extendTheme(__spreadProps(__spreadValues({}, foundations), {
      • line 1053: colors: __spreadProps(__spreadValues({}, chakraReact.theme.colors), { brand: chakraReact.theme.colors.blue }),
    • After changing the file, apply patch-package:
      • yarn add patch-package postinstall-postinstall
      • yarn patch-package @chakra-ui/pro-theme
      • yarn patch-package
      • add to package.json inside scripts: "postinstall": "patch-package"
  • I would recommend reading patch-package README before doing that.
  • Also, it would be better releasing your own package instead of using this work around till devs fix this issue.

ondanieldev avatar Sep 01 '22 20:09 ondanieldev