Skip to content

oxfmt: Tailwind config paths resolved inconsistently in subdirectories #18628

@saharbit

Description

@saharbit

When using oxfmt in a monorepo subdirectory, the experimentalTailwindcss.config paths are resolved inconsistently depending on where the command is run from.

Environment

  • oxfmt version: 0.26.0
  • Config file location: frontend/.oxfmtrc.jsonc (subdirectory of monorepo)
  • Tailwind config location: frontend/src/tailwind.config.ts

The Problem

Given this config in frontend/.oxfmtrc.jsonc:

{
  "experimentalTailwindcss": {
    "config": "./src/tailwind.config.ts"
  }
}
  • Locally: Works correctly, resolves to <root>/frontend/src/tailwind.config.ts
  • In CI: Fails, resolves to <root>/src/tailwind.config.ts (missing frontend/ prefix)

Error Message (CI)

Unable to load your Tailwind CSS v3 config: /home/ci/project/src/tailwind.config.ts

Failed to format file with external formatter: .../Component.module.css
JS formatFile promise rejected for file: 'Component.module.css', parser: 'css': GenericFailure, 
Error: Cannot find module '/home/ci/project/src/tailwind.config.ts'

The path is missing the frontend/ subdirectory where both the oxfmt config and tailwind config actually reside.

Expected Behavior

Paths in the config should be resolved relative to the config file location, so ./src/tailwind.config.ts always resolves to <config-dir>/src/tailwind.config.ts regardless of the current working directory.

Workaround

Currently using sed to adjust paths based on environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions