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

Still use the old preprocessor after changing lang of style tag #4214

Closed
6 tasks done
cj1128 opened this issue Jul 12, 2021 · 0 comments · Fixed by #4224
Closed
6 tasks done

Still use the old preprocessor after changing lang of style tag #4214

cj1128 opened this issue Jul 12, 2021 · 0 comments · Fixed by #4224
Labels
feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@cj1128
Copy link

cj1128 commented Jul 12, 2021

Describe the bug

Create a simple vue component and everything works fine.

<template lang="pug">
.bar
  h1 this is bar
</template>

<script>
export default {}
</script>

<style lang="scss" scoped>
h1 {
  color: blue;
}
</style>

But after I change the lang attribute of style tag from scss to stylus and modify the code to

h1
  color: blue

vite emitted an internal server error.

11:29:11 AM [vite] hmr update /src/components/Bar.vue?vue&type=style&index=0&scoped=true&lang.scss
11:29:11 AM [vite] Internal server error: expected "{".
   ╷
12 │   color: blue
   │              ^
   ╵
  src/components/Bar.vue 12:14  root stylesheet
  Plugin: vite:css
  File: /Users/cj/Desktop/Lab/vue2-vite-lab/src/components/Bar.vue
  Error: expected "{".
     ╷
  12 │   color: blue
     │              ^
     ╵
    src/components/Bar.vue 12:14  root stylesheet
      at Object._newRenderError (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:13231:19)

It seems that vite still thinks this is scss rather than a stylus code.

Reproduction

You can easily reproduce the bug by following the description.

I used the vue2 plugin but it doesn't matter. I checked that it can be reproduced in vue3.

System Info

System:
    OS: macOS 11.2.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 56.57 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.14.0 - /var/folders/49/7ydn2n095x90t_qdh7y9pzsh0000gn/T/fnm_multishells/56185_1625804117253/bin/node
    Yarn: 1.22.10 - /var/folders/49/7ydn2n095x90t_qdh7y9pzsh0000gn/T/fnm_multishells/56185_1625804117253/bin/yarn
    npm: 7.7.6 - /var/folders/49/7ydn2n095x90t_qdh7y9pzsh0000gn/T/fnm_multishells/56185_1625804117253/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 89.0
    Safari: 14.0.3
  npmPackages:
    vite: 2.4.1 => 2.4.1

Used Package Manager

yarn

Logs

vite:hmr [file change] src/components/Bar.vue +4s
  vite:hmr [vue:update(style)] /Users/cj/Desktop/Lab/vue2-vite-lab/src/components/Bar.vue +0ms
11:45:48 AM [vite] hmr update /src/components/Bar.vue?vue&type=style&index=0&scoped=true&lang.scss
  vite:load 0ms   [plugin] /src/components/Bar.vue?vue&type=style&index=0&scoped=true&lang.scss +4s
11:45:48 AM [vite] Internal server error: expected "{".
   ╷
12 │   color: blue
   │              ^
   ╵
  src/components/Bar.vue 12:14  root stylesheet
  Plugin: vite:css
  File: /Users/cj/Desktop/Lab/vue2-vite-lab/src/components/Bar.vue
  Error: expected "{".
     ╷
  12 │   color: blue
     │              ^
     ╵
    src/components/Bar.vue 12:14  root stylesheet
      at Object._newRenderError (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:13231:19)
      at Object._wrapException (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:13059:16)
      at _render_closure1.call$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:82010:21)
      at _RootZone.runBinary$3$3 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:27550:18)
      at _FutureListener.handleError$1 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26099:19)
      at _Future__propagateToListeners_handleError.call$0 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26397:49)
      at Object._Future__propagateToListeners (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:4550:77)
      at _Future._completeError$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26229:9)
      at _AsyncAwaitCompleter.completeError$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:25883:12)
      at Object._asyncRethrow (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:4349:17)
      at /Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:12872:20
      at _wrapJsFunctionForAsync_closure.$protected (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:4374:15)
      at _wrapJsFunctionForAsync_closure.call$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:25904:12)
      at _awaitOnObject_closure0.call$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:25896:25)
      at _RootZone.runBinary$3$3 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:27550:18)
      at _FutureListener.handleError$1 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26099:19)
  vite:time 22ms  /src/components/Bar.vue?import&vue&type=style&index=0&scoped=true&lang.scss +4s
  vite:load 0ms   [plugin] /src/components/Bar.vue?vue&type=style&index=0&scoped=true&lang.scss +23ms
11:45:48 AM [vite] Internal server error: expected "{".
   ╷
12 │   color: blue
   │              ^
   ╵
  src/components/Bar.vue 12:14  root stylesheet
  Plugin: vite:css
  File: /Users/cj/Desktop/Lab/vue2-vite-lab/src/components/Bar.vue
  Error: expected "{".
     ╷
  12 │   color: blue
     │              ^
     ╵
    src/components/Bar.vue 12:14  root stylesheet
      at Object._newRenderError (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:13231:19)
      at Object._wrapException (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:13059:16)
      at _render_closure1.call$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:82010:21)
      at _RootZone.runBinary$3$3 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:27550:18)
      at _FutureListener.handleError$1 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26099:19)
      at _Future__propagateToListeners_handleError.call$0 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26397:49)
      at Object._Future__propagateToListeners (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:4550:77)
      at _Future._completeError$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26229:9)
      at _AsyncAwaitCompleter.completeError$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:25883:12)
      at Object._asyncRethrow (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:4349:17)
      at /Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:12872:20
      at _wrapJsFunctionForAsync_closure.$protected (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:4374:15)
      at _wrapJsFunctionForAsync_closure.call$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:25904:12)
      at _awaitOnObject_closure0.call$2 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:25896:25)
      at _RootZone.runBinary$3$3 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:27550:18)
      at _FutureListener.handleError$1 (/Users/cj/Desktop/Lab/vue2-vite-lab/node_modules/sass/sass.dart.js:26099:19) (x2)
  vite:time 9ms   /src/components/Bar.vue?import&vue&type=style&index=0&scoped=true&lang.scss +11ms

Validations

@haoqunjiang haoqunjiang added bug feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jul 13, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants