question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing <style lang="scss">...</style> while `nuxt dev` causes error

See original GitHub issue

Environment


  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.10
  • Nitro Version: 0.5.4
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-bqwhz6?file=app.vue

Describe the bug

While nuxt dev is running, remove the whole section <script lang="scss">...</script> from app.vue and reload page.

 ERROR  9:53:15 PM [vite] Internal server error: [sass] expected "{".                            21:53:15
  ╷
5 │ </template>
  │            ^
  ╵
  app.vue 5:12  root stylesheet
  Plugin: vite:css
  File: /home/projects/nuxt-starter-bqwhz6/app.vue
  Error: expected "{".
    ╷
  5 │ </template>
    │            ^
    ╵
    app.vue 5:12  root stylesheet
      at Object.wrapException (/home/projects/nuxt-starter-bqwhz6/node_modules/sass/sass.dart.js:1247:17)

Additional context

No response

Logs

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aesyonducommented, Sep 21, 2022

This seems like it might be a vite error. Would you test with https://stackblitz.com/github/nuxt-contrib/vue3-ssr-starter/tree/main?

https://stackblitz.com/edit/github-innzae?file=src%2FApp.vue

Unable to reproduce. I added npm i -D sass and replaced the style with lang="scss".

0reactions
rlSimonLicommented, Dec 7, 2022

Just to add more data point to this issue, similar error can be triggered using PostCSS.

Steps to reproduce

  1. install and configure autoprefixer so PostCSS does things
  2. add some styles, save it, and remove all styles (you don’t actually need to remove the style tags themselves)
  3. manually refresh page

Demo: https://stackblitz.com/edit/nuxt-starter-cq84x7?file=app.vue

screenshot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration - Nuxt
By default, Nuxt is configured to cover most use cases. This default configuration can be overwritten with the nuxt.config.js file.
Read more >
How to setup SASS/SCSS/sass-loader in Nuxt - Stack Overflow
Finally I managed to fix the problem by downgrading the loader also followed by removing and installing again nuxt.
Read more >
vue-loader - npm
An SFC loaded in custom elements mode inlines its <style> tags as strings under the component's styles option. When used with ...
Read more >
CSS Transitions In Vuejs And Nuxtjs - Smashing Magazine
In this tutorial, we'll look at the different ways to apply transitions in both Vue.js and Nuxt.js applications. Transitions are a module of...
Read more >
Globally accessible CSS and SCSS/ SASS in your Nuxt ...
When building an App in Nuxt, it's likely you may choose to take advantage of the style tag with your single file components....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found