mantine: ReferenceError: Buffer is not defined

What package has an issue

@mantine/ssr

Describe the bug

Following the mantine directions on getting started on remix I get ReferenceError: Buffer is not defined

# this is the basic stup I did to make this project

npx create-remix@latest mantine-remix

# What type of app do you want to create? Just the basics
# Where do you want to deploy? Choose Remix if you're unsure, it's easy to change deployment targets. Cloudflare Workers
# TypeScript or JavaScript? JavaScript
# Do you want me to run `npm install`? Yes

cd mantine-remix
npm install @mantine/hooks @mantine/core @mantine/ssr

# replace entry.server.jsx with js equiv of text in article

npm run dev

In which browser did the problem occur

N/A

If possible, please include a link to a codesandbox with the reproduced problem

N/A

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

This was a huge pain to fix. I managed to fix it and wrote up a guide so other’s don’t have to suffer.

The two issues I had were:

  1. Not working with Cloudflare (solution was to write my own createStylesServer using an Emotion server that didn’t have the node bits.
  2. A flash of unstyled content (FUOC) causing a janky UX. I fixed this by ensuring the same cache is used everywhere.
  3. The <style> tags for global styles being rendered in the body. Fixed by wrapping app inside an Emotion CacheProvider in `entry.server.tsx

Repo that works with the latest Mantine, latest Remix & Cloudflare Pages/Workers: nastynaz/mantine-remix-cloudflare

@rtivital What do you think about updating the official docs to make the integration more seamless? I’m happy to do it if you accept PRs, just let me know where.

Alright, if you find a working solution, please ping me, I’ll add it to documentation

Emotion server does not support cloudflare-workers