How to import Tailwind configuration values from Qwik components?

218 Views Asked by At

I'm trying to import some configurations from Tailwin in Qwik component.

Inside tailwind.config.js I have this code:

// tailwind.config.js file

const defaultTheme = require('tailwindcss/defaultTheme')
// custom configuration

const { sm, md, lg, xl } = defaultTheme.screens

module.exports.sm = sm.replace('px', '') * 1;
module.exports.md = md.replace('px', '') * 1;
module.exports.lg = lg.replace('px', '') * 1;
module.exports.xl = xl.replace('px', '') * 1;

And inside my Qwik component:

import { sm, md, lg, xl } from '../../tailwind.config.js'

However, I get this error:

[vite] Internal server error: require is not defined

How can I export config from Tailwind and import it in my Qwik components?

0

There are 0 best solutions below