New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt 3 issue "Cannot read property 'resolveAlias' of undefined" #387
Comments
See also #386 |
@nuxt-bridge is same. ERROR Cannot start nuxt: Cannot read properties of undefined (reading 'resolveAlias')
at Object.tailwindCSSModule (node_modules/@nuxtjs/tailwindcss/dist/index.js:53:37)
at installModule (node_modules/@nuxt/kit/dist/index.mjs:1196:17)
at initNuxt (node_modules/nuxt3/dist/index.mjs:817:11)
at async load (node_modules/nuxi/dist/chunks/dev.mjs:6762:9)
at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6793:5)
at async _main (node_modules/nuxi/dist/chunks/index.mjs:417:7) |
An example of nuxt3 with tailwind: nuxt3-tailwind Thanks a lot to @JDIZM |
I think this package is no longer needed, because nuxt now uses webpack 5 and already supports tailwindcss.
|
<script lang="ts" setup>
import './assets/css/tailwind.css'
</script>
<template>
<NuxtPage />
</template> |
Is there a way to do this in the nuxt config file? (as opposed to in the app.vue file) |
Ohh it is, better approach I believe import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
css: ['~/assets/css/tailwind.css'],
}) |
Awesome, thanks! Makes me wonder now what's the use for the
|
/* ./assets/css/tailwind.css */ not import files on server include domain , works only on localhost. Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/css". Strict MIME type checking is enforced for module scripts per HTML spec. |
It's a pb with vite & postcss soon solved : nuxt/framework#818 |
Thanks for the updates! The module gives the possibility to other module authors to configure the tailwind config but we may see in the future if we have to deprecate this module. We recommend to use the |
After upgrading to the latest nuxt3 version, tailwind doesn't work for me anymore. I follow the instructions and yesterday it was working as expected. Haven't change anyhting, but today it doesn't work, without changing anything. It also doesn't show any erros. |
@chrispreisler I looked at @DengSihan his approach, he locked nuxt3 on a specific version. |
none of these works with latest nuxt3 version:
everything results in an unparsed css:
|
@MrParano1d check working repo https://github.com/productfrontenddeveloper/nuxt3-app |
Thank you @productfrontenddeveloper What got it working for my repo was:
I'm still learning |
fixed jit |
@productfrontenddeveloper you can remove the This is great, updating the module should be straightforward 😀 |
I tried this out & it worked for now. In the nuxt config file add the following.
Inside the tailwind config.js add the following
|
For me worked really simple with following Tailwind CSS Docs and @neilmispelaar recommendation. # Generate a new nuxt3 app
npx nuxi init nuxt3-app
# go into directory
cd nuxt3-app
# install dependencies
npm install
# install Tailwind necessary dependencies
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
# generate Tailwind and Postcss config
npx tailwindcss init -p nuxt.config.ts import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
// Add entry css file
css: ['tailwindcss/tailwind.css'],
build: {
postcss: {
// add Postcss options
postcssOptions: require('./postcss.config.js'),
},
},
})
|
Atinux say We recommend to use the app.vue to have HMR instead of using the nuxt.config file (the css prop should be kept only for module authors) Please check repo setup :) -> https://github.com/productfrontenddeveloper/nuxt3-app |
@productdevbook Good point. In my case nux.config.ts import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
css: ['tailwindcss/tailwind.css'],
// Restart server when these change
watch: ['~/postcss.config.js', '~/tailwind.config.js'],
build: {
postcss: {
postcssOptions: require('./postcss.config.js'),
},
},
}) |
This worked amazingly. Had to change Expecting an update to the tailwind docs around this. |
I tried all of the above but did not work. I removed jit mode from tailwind.config.js, and it worked!!! I am not sure why, lets hope it helps! so happy now! |
I think this one very simple & nice solution 👍 |
|
Trying to figure this out but no luck! Has anyone managed to get it to reload? |
5.0.0-alpha released with Nuxt 3 and Tailwindcss 3 support. Release notes https://github.com/nuxt-community/tailwindcss-module/releases/tag/v5.0.0-0. |
Version
@nuxtjs/tailwindcss: 4.2.1
nuxt: nuxt3@3.0.0-27234271.da7ff44
Reproduction Link
https://codesandbox.io/s/hungry-diffie-k8odx
Steps to reproduce
none
What is Expected?
no error to be produced
What is actually happening?
error is produced:
The text was updated successfully, but these errors were encountered: