lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

🐛 BUG:

Open enricogallesio opened this issue 3 years ago • 1 comments

What version of astro are you using?

1.0.0-rc.6

Are you using an SSR adapter? If so, which one?

none

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

Not sure if this can be considered a bug or deserves further investigation, but when using background-image: url();

if the filename contains a non escaped space character, for example: background-image: url('/filename spaced.jpg'); AND the file exists with that same filename or it is starting with that same filename until the space, astro gives no error in dev but gives an error in build

11:47:22 [build] Building static entrypoints...
[@astrojs/rollup-plugin-build-css-minify] Transform failed with 1 error:
<stdin>:1:202: ERROR: Expected ")" to end URL token
 error   Transform failed with 1 error:
  <stdin>:1:202: ERROR: Expected ")" to end URL token
  File:
    <stdin>
  Code:
      1623 |   }).join("");
    > 1624 |   let error = new Error(`${text}${summary}`);
           |               ^
      1625 |   error.errors = errors;
      1626 |   error.warnings = warnings;
      1627 |   return error;

this can be reproduced adding the above background-image in the index.astro file in the astro basic template, adding also an image file in /public and running build. Not sure if the codesandbox example attached helps.

The error in build can be obviously avoided be removing spaces in filenames (and path i guess) or properly escaping that.

Link to Minimal Reproducible Example

https://codesandbox.io/s/sharp-babycat-v01ttb?file=/src/pages/index.astro

Participation

  • [ ] I am willing to submit a pull request for this issue.

enricogallesio avatar Aug 05 '22 10:08 enricogallesio