Skip to content

unocss/postcss does not recognise the contents of the packages/** in next monorepo #4094

@blacksand

Description

@blacksand

UnoCSS version

0.62.0

Describe the bug

The monorepo structure is as follows, worked as expected in 0.61.9

After upgrade to 0.62.0, the contents of the packages/** cannot be extracted.

.
├── apps
│   └── web   # <-- next.js app
│       ├── src
│       ├── postcss.config.mjs
│       └── uno.config.mjs
└── packages
    ├── ...
    ├── ui-echarts
    └── ui-web
// postcss.config.mjs
const config = {
  plugins: [
    '@unocss/postcss',
  ],
}

export default config
// uno.config.mjs
import path from 'node:path'
import {fileURLToPath} from 'node:url'
import {defineConfig, presetUno, transformerDirectives} from 'unocss'

const projectRoot = path.dirname(fileURLToPath(import.meta.url))
const workspaceRoot = path.resolve(projectRoot, '../..')

// console.log({projectRoot, workspaceRoot})

const config = defineConfig({
  presets: [
    presetUno(),
  ],
  transformers: [
    transformerDirectives(),
  ],
  content: {
    filesystem: [
      `${projectRoot}/src/**/*.{tsx,html}`,
      `${workspaceRoot}/packages/ui-*/src/**/*.{tsx,html}`
    ]
  }
})

export default config

The image above is the output of v0.61.9 ✅ and the following is v0.62.0 ❌
CleanShot 2024-08-22 at 19 51 46@2x

Reproduction

blacksand/unocss-postcss-issue-report

System Info

Node: 20.16.0
OS: darwin-x64
pnpm: 9.7.1

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions