Skip to content

Invalid substitution for placeholder "[name]" error happens when a resolved id starts with / and preserveModules: true is set on Windows #5620

@sapphi-red

Description

@sapphi-red

Rollup Version

4.21.0

Operating System (or Browser)

Windows

Node Version (if applicable)

No response

Link To Reproduction

https://stackblitz.com/edit/rollup-repro-4ajmuo?file=rollup.config.js

Expected Behaviour

No error happens. Given that the chunk name is not explicitly specified, I expect rollup to generate a chunk name that is not an absolute nor relative path.

Actual Behaviour

The following error happens on Windows. The error doesn't happen on stackblitz.

Invalid substitution "C:/path" for placeholder "[name]" in "output.entryFileNames" pattern, can be neither absolute nor relative path.

if (isPathFragment(replacement))
return error(
logFailedValidation(
`Invalid substitution "${replacement}" for placeholder "[${type}]" in "${patternName}" pattern, can be neither absolute nor relative path.`
)
);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions