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

@nx/next: buildable libraries and css issue #30237

Open
1 of 4 tasks
y-lazarenka opened this issue Mar 1, 2025 · 1 comment
Open
1 of 4 tasks

@nx/next: buildable libraries and css issue #30237

y-lazarenka opened this issue Mar 1, 2025 · 1 comment

Comments

@y-lazarenka
Copy link

Current Behavior

When using @nx/next, the following issues occur:

  1. Buildable libraries are not supported properly:
    • When selecting a suggested bundler to build a library, the expected configuration is not generated.
    • The build task is missing, making it impossible to build the library.
  2. Broken Styles in Generated Code:
    • When selecting Tailwind CSS during setup, the generated components do not use Tailwind classes as expected.
    • Instead, the generated code references a missing CSS module named "styles", leading to broken styles

Expected Behavior

  • A proper build configuration should be generated for buildable libraries, and the build task should be available. Or CLI should prevent users from selecting a bundler to avoid misleading users.
  • When Tailwind is selected, the generated components should correctly use Tailwind classes instead of a non-existent CSS module.

GitHub Repo

No response

Steps to Reproduce

execute step by step:

npx nx create-nx-workspace --pm pnpm
npx nx add @nx/next
npx nx g @nx/next:lib packages/my-new-lib

Options to select:

✔ Which stylesheet format would you like to use? · tailwind
✔ Which bundler would you like to use to build the library? Choose 'none' to skip build setup. · vite
✔ Which linter would you like to use? · eslint
✔ What unit test runner should be used? · jest

Nx Report

Node           : 22.14.0
OS             : linux-x64
Native Target  : x86_64-linux
pnpm           : 10.4.1

nx                     : 20.4.6
@nx/js                 : 20.4.6
@nx/jest               : 20.4.6
@nx/eslint             : 20.4.6
@nx/workspace          : 20.4.6
@nx/devkit             : 20.4.6
@nx/eslint-plugin      : 20.4.6
@nx/module-federation  : 20.4.6
@nx/next               : 20.4.6
@nx/react              : 20.4.6
@nx/web                : 20.4.6
@nx/webpack            : 20.4.6
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/next/plugin
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@Playjasb2
Copy link

I'm facing same sort of issue on macOS. In my current project, I am using a prior version of Nx before Project Crystal, and I'm currently testing on a clean workspace setup how to get buildable libraries going, and the whole setup is broken. If I try to generate a library from the @nx/next generator, it doesn't create the library in a way that makes it immediately buildable. There was no "build" target being inferred.

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

No branches or pull requests

2 participants