Skip to content

fix(cli): resolve Windows path separator bug in plugin loader#3458

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
dzeroone:fix/windows-path-separator-plugin-loader
Jun 8, 2026
Merged

fix(cli): resolve Windows path separator bug in plugin loader#3458
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
dzeroone:fix/windows-path-separator-plugin-loader

Conversation

@dzeroone

@dzeroone dzeroone commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

  • Fix for Windows compatibility issue

Description

On Windows, path.join(item, PLUGIN_ENTRY_FILENAME) produces backslashes (e.g. @nestjs/graphql\plugin), which causes require.resolve to fail when the NestJS CLI attempts to load GraphQL plugins from nest-cli.json.

Using a forward-slash path (${item}/${PLUGIN_ENTRY_FILENAME}) resolves correctly on all platforms including Windows.

Steps to reproduce

  1. Install @nestjs/cli v12 alpha on Windows
  2. Add @nestjs/graphql to plugins in nest-cli.json
  3. Run nest build — fails with plugin resolution error

Related issue

Windows backslash in path.join breaks require.resolve for npm packages with scoped names (e.g. @nestjs/graphql).

On Windows, path.join(item, PLUGIN_ENTRY_FILENAME) produces backslashes
(e.g. '@nestjs/graphql\plugin'), which causes require.resolve to fail.

Use forward slash ('/') instead, which works
correctly on all platforms including Windows.

Fixes #N/A
@kamilmysliwiec kamilmysliwiec merged commit f43b0e7 into nestjs:master Jun 8, 2026
1 check passed
@kamilmysliwiec

Copy link
Copy Markdown
Member

LGTM

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants