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

build(vite): fix assets directories with symlinks present #3359

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

cathyjf
Copy link
Contributor

@cathyjf cathyjf commented Nov 2, 2024

Description

This commit addresses a situation where the user clones the Sunshine
directory in a location such that an ancestor of the repository is a
symlink. For example, imagine that the ~/git directory is a symlink
to the ~/Documents/git directory. Further imagine that the user clones
Sunshine into ~/git/Sunshine. In this setup, attempting to build
the web-ui will fail with a series of incredibly cryptic error messages,
which look like this:

RollupError: The "fileName" or "name" properties of emitted chunks
and assets must be strings that are neither absolute nor relative
paths, received "../../../../../../Documents/git/Sunshine/src_assets/common/assets/web/password.html".

This seems to occur because vite isn't aware that Documents/git and
git are actually the same directory as each other.

To fix the problem, this commit resolves the symlinks (if any) in
vite.config.js so that vite will only have to deal with one
canonical path, rather than two. This prevents the error when building.

Screenshot

N/A

Issues Fixed or Closed

N/A

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components (N/A)

This commit addresses a situation where the user clones the Sunshine
directory in a location such that an ancestor of the repository is a
symlink. For example, imagine that the `~/git` directory is a symlink
to the `~/Documents/git` directory. Further imagine that the user clones
Sunshine into `~/git/Sunshine`. In this setup, attempting to build
the web-ui will fail with a series of incredibly cryptic error messages,
which look like this:

    RollupError: The "fileName" or "name" properties of emitted chunks
    and assets must be strings that are neither absolute nor relative
    paths, received "../../../../../../Documents/git/Sunshine/src_assets/common/assets/web/password.html".

This seems to occur because vite isn't aware that `Documents/git` and
`git` are actually the same directory as each other.

To fix the problem, this commit resolves the symlinks (if any) in
`vite.config.js` so that vite will only have to deal with one
canonical path, rather than two. This prevents the error when building.
Copy link

sonarcloud bot commented Nov 2, 2024

@ReenigneArcher ReenigneArcher changed the title fix(web-ui): fix build if ancestor directory of repository is a symlink build(vite): fix assets directories with symlinks present Nov 2, 2024
@ReenigneArcher ReenigneArcher enabled auto-merge (squash) November 2, 2024 15:20
Copy link

codecov bot commented Nov 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 11.05%. Comparing base (03253fc) to head (bffa5cf).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3359   +/-   ##
=======================================
  Coverage   11.05%   11.05%           
=======================================
  Files          99       99           
  Lines       17231    17231           
  Branches     8034     8034           
=======================================
  Hits         1905     1905           
  Misses      12641    12641           
  Partials     2685     2685           
Flag Coverage Δ
Linux 8.35% <ø> (ø)
Windows 5.23% <ø> (ø)
macOS-13 13.61% <ø> (ø)
macOS-14 12.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@ReenigneArcher ReenigneArcher merged commit c54664b into LizardByte:master Nov 2, 2024
36 checks passed
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