Skip to content

Conversation

jussirantala
Copy link

@jussirantala jussirantala commented Apr 29, 2025

All relative paths were resolved to current dir ./ even though they should be for example ../ on Windows 11 and it was caused because chunkInfo.fileName had backward slashes \ instead of forward slashes /. This caused broken builds.

Looks like normalize or relative doesn't work with backward slashes so the bug was fixed with replacing Windows separator with posix separator. On posix system it just replaces posix separator with posix sep again so Mac or Linux is not affected (I tested on Mac).

Copy link

changeset-bot bot commented Apr 29, 2025

⚠️ No Changeset found

Latest commit: 92ce51c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@askoufis
Copy link
Contributor

askoufis commented Jul 6, 2025

@jussirantala Could you try and recreate the issue in a test case or raise an issue with a minimal reproduction? I can't manage to get chunkInfo.fileName to contain a relative path as rollup prevents emitting files to relative paths. Is there another way to get relative filenames?

@jussirantala
Copy link
Author

jussirantala commented Aug 4, 2025

@jussirantala Could you try and recreate the issue in a test case or raise an issue with a minimal reproduction? I can't manage to get chunkInfo.fileName to contain a relative path as rollup prevents emitting files to relative paths. Is there another way to get relative filenames?

@askoufis I'll try to find time for that but what do you mean with rollup preventing emitting files to relative paths? You just need to have something being imported from a upper directory. For example you could import some classes in your styling file from ../internal/baseStyles but this bug changes the path to ./internal/baseStyles causing a broken build.

@jussirantala
Copy link
Author

@askoufis

So you were using Windows when you tested, right?

@askoufis
Copy link
Contributor

@jussirantala I'm still not able to reproduce what you're talking about. This was my attempt to understand you situation. I made a nested entrypoint in a package that imports a file from a parent directory. The relative path looks correct to me.

This is why it would be very helpful if you could create a minimal reproduction of the issue in a repo so I can test it out. Alternative, if you fork the repo and create a failing test case then that would also be useful so I can validate your solution.

@jussirantala
Copy link
Author

jussirantala commented Sep 23, 2025

@jussirantala I'm still not able to reproduce what you're talking about. This was my attempt to understand you situation. I made a nested entrypoint in a package that imports a file from a parent directory. The relative path looks correct to me.

This is why it would be very helpful if you could create a minimal reproduction of the issue in a repo so I can test it out. Alternative, if you fork the repo and create a failing test case then that would also be useful so I can validate your solution.

@askoufis
It doesn't look correct to me: https://github.com/vanilla-extract-css/vanilla-extract/compare/rollup-windows-path-test?expand=1#diff-71eed780184ba3d1ce66f1cce1ba6872fa8d58d1237f7ed6e462bdccc24e3327R876

It's pointing to current directory instead of the upper directory.

@askoufis
Copy link
Contributor

askoufis commented Sep 23, 2025

It's pointing to current directory instead of the upper directory.

@jussirantala
It's pointing to the current directory because that's where the file is emitted to. If I change the rollup input so it emits that file into a nested directory, then the imports reference the parent directory. See here. The ./.. in the import paths is a bit strange but it's a simple way to enforce a relative path in all cases, and has worked fine for years in the plugin.

Once again, I'd greatly appreciate if you could make a minimal reproduction of your specific issue, instead of me trying to blindly reproduce it.

@jussirantala
Copy link
Author

Thanks for testing it. I will try to find out time for the minimal repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants