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

Fix duplicate output with multiple entry points on Windows (host normalization) #251

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

antross
Copy link
Contributor

@antross antross commented Nov 11, 2020

On Windows the normalized paths in resolveId end up in POSIX format.
This cause rollup to treat the returned path as a new piece of content.
This in turn results in duplicate output for references across entry points.

Fixed by normalizing the path to use host OS separators before returning.

See https://github.com/antross/rollup-plugin-typescript2-repro for a repro project.

On Windows the normalized paths in resolveId end up in POSIX format.
This cause rollup to treat the returned path as a new piece of content.
This in turn results in duplicate output for references across entry points.

Fixed by normalizing the path to use host OS separators before returning.
@ezolenko
Copy link
Owner

Looks like this is a workaround for rollup/rollup#3094. I feel we'll have to revisit it again when something changes :)

@ezolenko ezolenko merged commit 6fb0e75 into ezolenko:master Nov 20, 2020
@githoniel
Copy link

when will this release?

this will also fix preserveModuleRoot in windows.

preserveModuleRoot will use path segment separation depending by OS in Rollup but this this plugin will always use /

@ezolenko
Copy link
Owner

ezolenko commented Feb 18, 2021

@githoniel released in 0.30.0, sorry for the delay

@agilgur5 agilgur5 changed the title Fix duplicate output with multiple entry points Fix duplicate output with multiple entry points on Windows (POSIX) May 3, 2022
@agilgur5 agilgur5 added kind: bug Something isn't working properly topic: OS separators Path normalization between OSes. Windows = '\', POSIX = '/'. Rollup resolve = native, TS = POSIX labels May 3, 2022
Repository owner locked as resolved and limited conversation to collaborators May 3, 2022
@agilgur5 agilgur5 changed the title Fix duplicate output with multiple entry points on Windows (POSIX) Fix duplicate output with multiple entry points on Windows (host normalization) May 27, 2022
Repository owner unlocked this conversation Jun 23, 2022
@agilgur5 agilgur5 linked an issue Jun 23, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working properly topic: OS separators Path normalization between OSes. Windows = '\', POSIX = '/'. Rollup resolve = native, TS = POSIX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

code splitting broken on Windows
4 participants