Comments (2)
Could be something to do with @shuriken-ui/next
– removing it removes the error. It could also be @nuxt/tailwindcss
, as the null
comes from a cached .nuxt/tailwindcss.config.js
it reads, which has (notice the null
in the plugins
):
module.exports = (() => {const cfg=config;cfg["presets"] = [];cfg["presets"]["0"] = {"darkMode":"class","content":[],"plugins":[null,
As of note, the official Tailwind documentation does not mention using @nuxt/tailwindcss
to integrate Tailwind into Nuxt.js.
I decided to delve a little deeper. It seems to be an incompatibility with plugin.withOptions()
usage when extending a Tailwind configuration using the tailwindcss:config
hook provided by @nuxtjs/tailwindcss
. When configuration is modified in this hook, the configuration is serialized in .nuxt/tailwind.config.cjs
using JSON.stringify()
. However, when a plugin uses plugin.withOptions()
, this returns a function. When one does JSON.stringify()
on the function in this context, it resolves to null
. This is the null
we end up seeing in the .nuxt/tailwind.config.cjs
that gets used later, that causes the error. One can reproduce the error with the following minimal configuration:
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
hooks: {
'tailwindcss:config'(config) {
config.plugins = [
require('tailwindcss/plugin').withOptions(() => ({}))
]
},
},
modules: ["@nuxtjs/tailwindcss"]
})
Which gives:
// generated by the @nuxtjs/tailwindcss <https://github.com/nuxt-modules/tailwindcss> module at 4/28/2024, 8:10:01 PM
const configMerger = require("/home/user/projects/test/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxtjs/tailwindcss/dist/runtime/merger.mjs");
const inlineConfig = {"content":[],"theme":{"extend":{}},"plugins":[]};
const config = [
require("./../tailwind.config.js")
].reduce((prev, curr) => configMerger(curr, prev), configMerger(inlineConfig, { content: ["/home/user/projects/test/components/**/*.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/components/global/**/*.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/components/**/*.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/layouts/**/*.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/pages/**/*.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/plugins/**/*.{js,ts,mjs}","/home/user/projects/test/composables/**/*.{js,ts,mjs}","/home/user/projects/test/utils/**/*.{js,ts,mjs}","/home/user/projects/test/{A,a}pp.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/{E,e}rror.{vue,js,jsx,mjs,ts,tsx}","/home/user/projects/test/app.config.{js,ts,mjs}"] }));
module.exports = (() => {const cfg=config;cfg["plugins"] = [null];;return cfg;})()
This relates to @shuriken-ui/nuxt
since it uses @shuriken-ui/tailwind
. This package uses a preset that includes @tailwindcss/typography
, which uses plugin.withOptions()
.
from tailwindcss.
I found a fix after reading this https://github.com/nuxt-modules/tailwindcss/releases/tag/v6.12.0. If anyone comes across this issue, you should include your presets/plugins in tailwind.config.js
file. I was including them in tailwindcss:config
hook and getting that error.
from tailwindcss.
Related Issues (20)
- [Prettier Plugin] Handle two more plugins HOT 3
- not working in docker HOT 3
- other postcss plugins do not work with tailwindcss HOT 1
- `<alpha-value>` is not recognized on reuse HOT 2
- Vulnerable Dependency - micromatch HOT 3
- v4: tailwind.default is not a function when running with Angular 17 and esbuild
- Classes generation error using symlink HOT 1
- [v3] Double quotes break arbitrary variants HOT 2
- `dark:` does not work with `@apply` in v3.4.3
- Create plugin: addBase does not work inside of matchComponents
- Col-end does not support negative values HOT 2
- For example: min-[1620px] is not workin, tailwind dont see this, but media xl, 2xl, md he is see)) (sorry for my english)
- Tailwind Play and Play CDN don't work with some custom utilities HOT 3
- Classes are prefixed when using `has-*` variants with arbitrary values HOT 2
- Unable to set default light mode in Vercel portfolio template HOT 2
- Unable to add borderRadius in tailwind.config.js. Inside theme.extend property HOT 1
- Class detection in Ruby Template files
- Small bug on negative 0.5 classes (like "-left-0.5") HOT 2
- error in an import (flattenColorPalette) HOT 1
- Compiler Memory Leak when (repeatedly) copying files on Win x64
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss.