Skip to content
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

ERROR Importing directly from a nuxt.config file is not allowed. #429

Closed
Krystus opened this issue Feb 15, 2022 · 15 comments
Closed

ERROR Importing directly from a nuxt.config file is not allowed. #429

Krystus opened this issue Feb 15, 2022 · 15 comments
Labels
question Further information is requested wontfix This will not be worked on

Comments

@Krystus
Copy link

Krystus commented Feb 15, 2022

How to bypass that error?

ERROR Importing directly from a nuxt.config file is not allowed. Instead, use runtime config or a module. [importing /nuxt.config.js from index.html]

@Krystus Krystus added the question Further information is requested label Feb 15, 2022
Copy link
Collaborator

atinux commented Feb 15, 2022

Can you please share a reproduction, we cannot help you just with what you shared

@Krystus
Copy link
Author

Krystus commented Feb 15, 2022

Just basic Nuxt 3 + @nuxtjs/tailwindcss installation.

After some tests looks like error is off when I comment out one line in tailwindcss config.

nuxt.config.js:
import { defineNuxtConfig } from "nuxt3"

import { defineNuxtConfig } from "nuxt3"

export default defineNuxtConfig({
  tailwindcss: {
    viewer: false,
    config: {
      darkMode: "class",
      content: [
        `components/**/*.{vue,js}`,
        `composables/**/*.{vue,js}`,
        `layouts/**/*.vue`,
        `pages/**/*.vue`,
        `plugins/**/*.{js,ts}`,
        // `nuxt.config.{js,ts}`,
      ],
    },
  },
  buildModules: [
    "@nuxtjs/tailwindcss",
  ],
})

Copy link
Collaborator

atinux commented Feb 16, 2022

Can you reproduce by forking https://stackblitz.com/edit/nuxt-starter-rnulzp?file=app.vue ?

@afflexux
Copy link

StackBlitz

It is to do with the content [ ] in tailwind.config

Uncomment any of the last two entries and it breaks.

./*.{vue,js,ts} is not needed here anyway as they are covered individually but nuxt.config might be needed in some situations as mentioned here

@stale
Copy link

stale bot commented Apr 18, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 18, 2022
@stale stale bot closed this as completed Apr 27, 2022
@jovylle
Copy link

jovylle commented Jun 12, 2022

I do have this error. seemed so weird.

@lpknv
Copy link

lpknv commented Jul 4, 2022

I am also having the same issue (see below).
Haven't tried to reproduce it yet.

image

@lpknv
Copy link

lpknv commented Jul 4, 2022

I think I have found the error on my end:
I had "./nuxt.config.{js,ts}", in my tailwind.config.js. You may wonder why it is there, and here is the reason.

I removed the line and the error disappeared.

@jdchvz
Copy link

jdchvz commented Jul 5, 2022

I think I have found the error on my end: I had "./nuxt.config.{js,ts}", in my tailwind.config.js. You may wonder why it is there, and here is the reason.

I removed the line and the error disappeared.

this works to me, but what does it do? does this affect any thing?

@peace2074
Copy link

I think I have found the error on my end: I had "./nuxt.config.{js,ts}", in my tailwind.config.js. You may wonder why it is there, and here is the reason.

I removed the line and the error disappeared.

Thank you!!!
Thank you!!!
Thank you!!!

@lpknv
Copy link

lpknv commented Jul 7, 2022

I think I have found the error on my end: I had "./nuxt.config.{js,ts}", in my tailwind.config.js. You may wonder why it is there, and here is the reason.
I removed the line and the error disappeared.

this works to me, but what does it do? does this affect any thing?

Thats a good question: I guess tailwind cannot read CSS classes from *.config.{js,ts} files? Dunno...

chrstngyn pushed a commit to chrstngyn/port-of-mars that referenced this issue Jul 18, 2022
@SepehrMoafi
Copy link

thanks a lot

@FrancoLab
Copy link

Thanks!

chrstngyn pushed a commit to chrstngyn/port-of-mars that referenced this issue Aug 11, 2022
@paddotk
Copy link

paddotk commented Sep 29, 2022

Removing that line did not do it for me. I stopped the app, removed the line, cleared my yarn cache and restarted. I still see the same error.

@lpknv
Copy link

lpknv commented Sep 29, 2022

Removing that line did not do it for me. I stopped the app, removed the line, cleared my yarn cache and restarted. I still see the same error.

Can you share some of your code ? Maybe there is something else causing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

10 participants