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(build): don't rewrite CSS urls starting with $ #4269

Closed
wants to merge 1 commit into from

Conversation

prymitive
Copy link

@prymitive prymitive commented Jul 15, 2021

Description

URL might be a variable rather than a string.
When vite attempts to rewrite a variable it might produce bogus output as it doesn't know what value given variable holds.

Currently this can cause a build error like the one below:

Error: expected ")".
  ╷
9 │   @import url(../../node_modules/bootswatch/dist/darkly/$web-font-path);
  │               ^
  ╵
  node_modules/bootswatch/dist/darkly/_bootswatch.scss 9:15  @import
  src/Styles/DarkTheme.scss 75:9                             @import
  src/Styles/DarkThemeLoader.scss 2:11                       root stylesheet
error during build:
Error: expected ")".

See https://github.com/thomaspark/bootswatch/blob/52649a617b7f66f0e8bc8128926a5c195ea7a5b4/dist/darkly/_bootswatch.scss#L7-L10

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

URL might be a variable rather than a string.
When vite attempts to rewrite a variable it might produce bogus output as it doesn't know what value given variable holds.
Example of such code that currently doesn't build with vite: https://github.com/thomaspark/bootswatch/blob/52649a617b7f66f0e8bc8128926a5c195ea7a5b4/dist/darkly/_bootswatch.scss#L7-L10

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
@prymitive prymitive marked this pull request as ready for review July 15, 2021 17:14
@Shinigami92 Shinigami92 added p3-minor-bug An edge case that only affects very specific usage (priority) needs test labels Jul 15, 2021
@prymitive
Copy link
Author

Error: getaddrinfo ENOTFOUND playwright.azureedge.net

test failure seems unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs test p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants