Current Behavior
When building a project using @nx/rollup specifying additionalEntrypoints a warning is shown The pattern libs\test-lib\src\entrypoints\*.ts did not match any files even though the files exist
Expected Behavior
The additional entrypoints are found correctly.
GitHub Repo
https://github.com/theotonge/nx-additionalEntrypoints-error-example
Steps to Reproduce
With repo
- use windows
- clone https://github.com/theotonge/nx-additionalEntrypoints-error-example
- run
nx build test-lib
Manually
- use windows
- create a react lib with bundler as rollup
- modify project.json to:
"name": "test-lib",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/test-lib/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"options": {
"main": "libs/test-lib/src/index.ts",
"format": ["esm", "cjs"],
"additionalEntryPoints": ["libs/test-lib/src/entrypoints/*.ts"],
"generateExportsField": true
}
}
}
}
- create a file in libs/test-lib/src/entrypoints/thing.ts with an export
- create a file in libs/test-lib/src/entrypoints/other.ts with an export
- run
nx build test-lib
Nx Report
NX Report complete - copy this into the issue template
Node : 20.18.1
OS : win32-x64
Native Target : x86_64-windows
npm : 10.8.2
nx : 20.3.2
@nx/js : 20.3.2
@nx/jest : 20.3.2
@nx/eslint : 20.3.2
@nx/eslint-plugin : 20.3.2
@nx/module-federation : 20.3.2
@nx/react : 20.3.2
@nx/rollup : 20.3.2
@nx/vite : 20.3.2
@nx/web : 20.3.2
typescript : 5.6.3
---------------------------------------
Registered Plugins:
@nx/vite/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/rollup/plugin
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
The cause of the issue is because the createEntrypoints method is calling globSync from tinyglobby, passing a full windows path - tinyglobby only seems to support posix paths
As the paths are passed in as relative posix paths, working through the call stack I see that the paths are modified in withNx by calling path.join(workspaceRoot, entry) causing the conversion to windows path.
Replacing all separators at this point seems to solve the issue:
path.join(workspaceRoot, entry).replaceAll(path.sep, path.posix.sep)
Current Behavior
When building a project using @nx/rollup specifying additionalEntrypoints a warning is shown
The pattern libs\test-lib\src\entrypoints\*.ts did not match any fileseven though the files existExpected Behavior
The additional entrypoints are found correctly.
GitHub Repo
https://github.com/theotonge/nx-additionalEntrypoints-error-example
Steps to Reproduce
With repo
nx build test-libManually
nx build test-libNx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
The cause of the issue is because the createEntrypoints method is calling globSync from tinyglobby, passing a full windows path - tinyglobby only seems to support posix paths
As the paths are passed in as relative posix paths, working through the call stack I see that the paths are modified in withNx by calling
path.join(workspaceRoot, entry)causing the conversion to windows path.Replacing all separators at this point seems to solve the issue: