Skip to content

@nx/next:library Vite bundler not working #30356

Closed as not planned
Closed as not planned
@MateusRoscoe

Description

@MateusRoscoe

Current Behavior

Creating a library with Vite does not actually use vite at all

pnpm exec nx generate @nx/next:library --directory=libs/platform --bundler=vite --linter=eslint --name=platform --style=none --no-interactive 

UPDATE package.json
CREATE libs/platform/project.json
CREATE libs/platform/README.md
CREATE libs/platform/src/index.ts
CREATE libs/platform/tsconfig.lib.json
CREATE libs/platform/.babelrc
CREATE libs/platform/tsconfig.json
CREATE eslint.config.mjs
CREATE libs/platform/eslint.config.mjs
CREATE libs/platform/src/lib/platform.tsx
UPDATE tsconfig.base.json
CREATE libs/platform/src/server.ts
CREATE libs/platform/src/lib/hello-server.tsx

Also when creating a new publishable library with the following configuration I end up with both vite (with only vitest configured) and rollup.

pnpm exec nx generate @nx/next:library --directory=libs/platform --bundler=vite --linter=eslint --name=platform --unitTestRunner=vitest --publishable=true --style=none --no-interactive 


 NX  Generating @nx/next:library

Publishable libraries cannot be used with bundler: 'none'. Defaulting to 'rollup'.

CREATE libs/platform/rollup.config.cjs
CREATE libs/platform/vite.config.ts
...

Expected Behavior

I would expect the option to use Vite as the bundler would use Vite as the bundler

GitHub Repo

No response

Steps to Reproduce

  1. Set up any NX monorepo on the latest version (20.5.0) utilizing pnpm
  2. Install @nx/next
  3. Run pnpm exec nx generate @nx/next:library --directory=libs/platform --bundler=vite --linter=eslint --name=platform --style=none --no-interactive

Nx Report

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

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

Failure Logs

Package Manager Version

No response

Operating System

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

Additional Information

Running WSL in windows.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions