gavinmcfarland / flex-gap-polyfill

A PostCSS plugin to emulate flex gap using margins
https://gavinmcfarland.github.io/flex-gap-polyfill/
Creative Commons Zero v1.0 Universal
143 stars 6 forks source link

Getting "Module is not defined" issue on next js #86

Open krishna-fenixwork opened 8 months ago

krishna-fenixwork commented 8 months ago

Hi, there

I'm using this library for browser compatibility of CSS gap property in Safari < 14. On localhost, it is working fine but when I deploy my next js application it says "Reference error: module is not defined". I use CSS modules.

I'm importing it into index.tsx file inside the pages directory like this -

import 'flex-gap-polyfill';

Here is the error -

image

Does anyone know how I can fix this issue? Is there any specific settings I need to do on next js?

gavinmcfarland commented 8 months ago

Hi! Thanks for reaching out.

In your nextjs project are you using PostCSS to apply flex-gqp-polyfill as a plugin? I'm not that familiar with nextjs, but my guess would be flex-gap-polyfill is not being applied correctly as a PostCSS plugin.