Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

CImage and CAvatar depend on process.browser, not working with Vite #434

Open
jongeyer opened this issue May 27, 2021 · 1 comment
Open
Labels
hacktoberfest type: bug 🐛 Something isn't working

Comments

@jongeyer
Copy link

jongeyer commented May 27, 2021

Describe the bug
CImage and CAvatar depend on process.browser which is causing problems with Vite (using vite-plugin-vue2)

To Reproduce
Steps to reproduce the behavior:

  1. Set up a Vite project with vite-plugin-vue2 and @chakra-ui/vue
  2. Add a CImage or CAvatar with a valid src
  3. Image does not appear at all
  4. See error in console
    image

Expected behavior
I expect CImage and CAvatar (and Chakra UI Vue overall) to work in a variety of

Desktop

  • OS: macOS 10.15.7
  • Browser: Chrome v90.0.4430.212, Brave, Safari

Additional context
CImage and CAvatar appear to be the only components using process.browser:
https://github.com/chakra-ui/chakra-ui-vue/search?q=process.browser&type=

I have a workaround for a custom polyfill in my main.js:

if (typeof process === 'undefined' && typeof window.process === 'undefined') {
  window.process = {
    browser: typeof window !== 'undefined'
  }
}

My understanding is that process.browser is a webpack-centric approach, whereas window !== 'undefined' is more universal.

@codebender828 codebender828 added the type: bug 🐛 Something isn't working label Jun 12, 2021
@codebender828
Copy link
Collaborator

Thanks @jongeyer To be fixed in next version 💪🏾

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hacktoberfest type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants