ui icon indicating copy to clipboard operation
ui copied to clipboard

Internal server error: [postcss] postcss-import: Unknown word

Open zAlweNy26 opened this issue 1 year ago • 5 comments

Environment

  • Operating System: Linux
  • Bun Version: v1.1.29
  • Vue Version: v3.5.13
  • Vite Version: v5.4.11
  • Package Manager: [email protected]

Is this bug related to Nuxt or Vue?

Vue

Version

v3.0.0-alpha.9

Reproduction

Unable to run on https://stackblitz.com/edit/vitejs-vite-2s99rp because of https://github.com/stackblitz/core/issues/1855 (I think) but I'll create a repo as soon as I can.

Description

After following the setup tutorial for the installation of Nuxt UI in a Vue-only environment and running the project, I get an error (see logs). The only different thing in the setup I had to do is that, as I am building a custom element, I did:

const Widget = defineCustomElement(App, {
	configureApp(app) {
		app.use(ui)
		app.use(i18n)
		app.provide(I18nInjectionKey, i18n)
	},
})

Instead of the usual createApp method. Did I miss something?

Additional context

No response

Logs

15:53:45 [vite] Internal server error: [postcss] postcss-import: /home/dany/Documenti/GitHub/chat-widget/node_modules/@nuxt/ui/dist/module.mjs:1:16: Unknown word
  Plugin: vite:css
  File: /home/dany/Documenti/GitHub/chat-widget/node_modules/@nuxt/ui/dist/module.mjs:1:15
  1  |  import defu, { defu as defu$1 } from 'defu';
     |                 ^
  2  |  import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, extendPages, hasNuxtModule, installModule } from '@nuxt/kit';
  3  |  import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates, c as buildTemplates } from './shared/ui.d52SSCwA.mjs';
      at Input.error (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/input.js:106:16)
      at Parser.unknownWord (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/parser.js:593:22)
      at Parser.other (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/parser.js:435:12)
      at Parser.parse (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/parser.js:470:16)
      at parse (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/parse.js:11:12)
      at get root [as root] (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/no-work-result.js:119:14)
      at Result.get [as root] (/home/dany/Documenti/GitHub/chat-widget/node_modules/postcss/lib/no-work-result.js:27:21)
      at loadImportContent (file:///home/dany/Documenti/GitHub/chat-widget/node_modules/vite/dist/node/chunks/dep-C6EFp3uH.js:867:33)
      at async Promise.all (index 0)
      at async resolveImportId (file:///home/dany/Documenti/GitHub/chat-widget/node_modules/vite/dist/node/chunks/dep-C6EFp3uH.js:800:27)
15:53:45 [vite] Pre-transform error: [postcss] postcss-import: /home/dany/Documenti/GitHub/chat-widget/node_modules/@nuxt/ui/dist/module.mjs:1:16: Unknown word

zAlweNy26 avatar Dec 03 '24 16:12 zAlweNy26

I have the exact same issue when trying to use Tailwinds's @source "PATH"

izoukhai avatar Dec 07 '24 12:12 izoukhai

if you find any solutions, please let me know

karombekHusanov avatar Dec 13 '24 19:12 karombekHusanov

I don't understand why postcss-import is trying to process a js file. I thought it was something with my setup, but everything seems fine. I'm still unable to find a solution for this.

zAlweNy26 avatar Dec 19 '24 10:12 zAlweNy26

Kept getting similar errors with "@nuxt/ui": "^2.21.1", on clean setup

 ERROR  Pre-transform error: [postcss] postcss-import: /home/.../nuxt-app/node_modules/tailwindcss/lib/index.js:1:1: Unknown word "use strict"               07:55:00
  Plugin: vite:css
  File: /home/.../nuxt-app/node_modules/tailwindcss/lib/index.js:1:0
  1  |  "use strict";
     |  ^
  2  |  module.exports = require("./plugin");
  3  |  

upgrading @nuxt/ui to ^3.0.0 by modifying package.json and rm -rf node_modules .nuxt package-lock.json; npm install solved those errors

tumoxep avatar Mar 15 '25 05:03 tumoxep

Are you sure you're adding TailwindCSS v4 correctly? A lot has changed since v3.

rozsazoltan avatar Apr 02 '25 07:04 rozsazoltan

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), they will be closed automatically after a while. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have templates to create a minimal reproduction:

  • Nuxt: https://codesandbox.io/p/devbox/nuxt-ui3-n3sxks
  • Vue: https://codesandbox.io/p/devbox/nuxt-ui3-vue-4h5gqn

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

github-actions[bot] avatar May 15 '25 14:05 github-actions[bot]

The issue seems to be fixed after the package went out of the beta

zAlweNy26 avatar May 15 '25 15:05 zAlweNy26