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

Configuration anomalies due to upgraded versions #3721

Open
4 tasks done
ZhongYanZhiShi opened this issue Apr 13, 2024 · 1 comment
Open
4 tasks done

Configuration anomalies due to upgraded versions #3721

ZhongYanZhiShi opened this issue Apr 13, 2024 · 1 comment

Comments

@ZhongYanZhiShi
Copy link

ZhongYanZhiShi commented Apr 13, 2024

UnoCSS version

0.59.0

Describe the bug

0.58.9 doesn't have this problem, but upgrading to 0.59.0+ does.

Reproduction

Bug Realization Methods

  • npx create-next-app@latest

  • yarn add @unocss/postcss@0.59.0 or yarn add @unocss/postcss@0.59.2

  • postcss.config.js

    module.exports = {
      plugins: {
        '@unocss/postcss': {
          content: ['**/*.{html,js,ts,jsx,tsx}'],
        },
      },
    }
  • uno.config.ts

    import { defineConfig, presetUno } from 'unocss'
    
    export default defineConfig({
      presets: [
        presetUno(),
        // ...
      ],
    })

As of 2024/04/13, the latest version 0.59.2, installing 0.59.0 and above gives this following error.

img-20240413-153129

System Info

{
  "name": "nextjs14.2",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "14.2.1",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@unocss/postcss": "^0.59.0",
    "eslint": "^8",
    "eslint-config-next": "14.2.1",
    "typescript": "^5",
    "unocss": "^0.59.0"
  }
}

Validations

@lzl0304
Copy link
Contributor

lzl0304 commented Apr 14, 2024

Had same error.
The reason is that after building, the default export of CJS was replaced.
https://github.com/unocss/unocss/pull/3380/files#diff-21462feba05a79008c54d9a3267569b27b8897540ac86e47110e57f25402d224R11

But Next.js plugins must be provided as strings.
https://nextjs.org/docs/messages/postcss-shape

You can roll back to version 0.58.9 until a solution is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants