Closed
Description
Environment
- Operating System:
Linux
- Node Version:
v16.12.0
- Nuxt Version:
2.16.0-27358576.777a4b7f
- Package Manager:
npm@8.1.0
- Builder:
webpack
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://codesandbox.io/s/pug-doctype-r94s3d?file=/pages/index.vue
Describe the bug
<script setup>
</script>
<template lang="pug">
div(v-if="true") foo
div(v-else) bar
</template>
div(v-else)
causes error.
Workaround:
- Use
div(v-else="")
- Add explicit
doctype
to the beginning of pug template. - Do NOT use
<script setup>
Additional context
No response
Logs
ERROR Failed to compile with 1 errors friendly-errors 17:54:31
ERROR in ./pages/index.vue friendly-errors 17:54:31
Module Error (from ./node_modules/@nuxt/bridge/node_modules/unplugin-vue2-script-setup/node_modules/unplugin/dist/webpack/loaders/transform.js):
Unexpected token (1:2)
friendly-errors 17:54:31
@ ./.nuxt/router.js 27:24-29:3
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./node_modules/@nuxt/bridge/dist/runtime/capi.plugin.mjs ./node_modules/eventsource-polyfill/dist/browserify-eventsource.js (webpack)-hot-middleware/client.js?reload=true&timeout=30000&ansiColors=&overlayStyles=&path=%2F__webpack_hmr%2Fclient&name=client ./.nuxt/client.js