Closed sambedingfield closed 3 years ago
Wow, that was a wild goose chase and completely unrelated to Windi or Vue CLI
🙃
After removing all the Windi @apply content-
it exposed that Google font import as the last remaining syntax error.
Turns out Webpack doesn't like those semicolons between font weights.
https://github.com/webpack/webpack/issues/10873
This works fine during npm run serve
and npm run lint
but fails during npm run build
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
Fixed with using an alternative Google font URL (css
instead of css2
, removing wght@
and ;
becomes ,
)
@import url('https://fonts.googleapis.com/css?family=Inter:300,400,500,600,700&display=swap');
(and a lot of swearing)
Oh that's weird! Thanks for the issue and explanation @sambedingfield
Can I recommend you go with the css2 font but add the import in your HML instead of the CSS. HTML is preferred because you're adding an extra network step to fetch the fonts inside the CS, which will decrease the CLS and LCP performance metrics
Good recommendation! Thanks.
Replaced @import
with the standard Google <link>
to src/public/index.html
.
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
I've been trying out Windi CSS and Vue CLI 4, which has been working great with
npm run serve
but now I've come to build, I keep running intoSyntaxError Unclosed string
errors.After trying to escape or remove the empty pseudo
content:"";
, I just run into similar errors, so something's not right 🤔There's nothing helpful in the logs and
npm run lint
doesn't return any errors.Any help much appreciated!
Here's my setup...
Additional notes:
<style lang="scss">
.vue-cli-plugin-windicss
and before using Windi with no issues.