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.

vue 2.6+ named slot and pug causes error

See original GitHub issue

Version

1.0.0-beta.29

Reproduction link

https://github.com/yoyoys/vue-slot-pug-bug-jest-reproduction

Steps to reproduce

  1. create project by vue-cli 3.6.3, using jest, TypeScript, TSLint, Class Component
  2. npm i -D pug pug-plain-loader
  3. add a component which has named slot (SlotGuy.vue)
  4. run npm run test:unit

What is expected?

test run success

What is actually happening?

I’ve got a error below:

  ● Test suite failed to run

    SyntaxError: Unexpected character '#' (1:150)

      at Parser.pp$4.raise (node_modules/vue-template-es2015-compiler/buble.js:2757:13)
      at Parser.pp$8.getTokenFromCode (node_modules/vue-template-es2015-compiler/buble.js:4906:8)
      at Parser.pp$8.readToken (node_modules/vue-template-es2015-compiler/buble.js:4628:15)
      at Parser.readToken (node_modules/vue-template-es2015-compiler/buble.js:6029:22)
      at Parser.pp$8.nextToken (node_modules/vue-template-es2015-compiler/buble.js:4619:15)
      at Parser.pp$8.next (node_modules/vue-template-es2015-compiler/buble.js:4576:8)
      at Parser.pp.eat (node_modules/vue-template-es2015-compiler/buble.js:577:10)
      at Parser.pp.expect (node_modules/vue-template-es2015-compiler/buble.js:641:8)
      at Parser.pp$1.parseFunctionParams (node_modules/vue-template-es2015-compiler/buble.js:1230:8)
      at Parser.pp$1.parseFunction (node_modules/vue-template-es2015-compiler/buble.js:1218:8)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

19reactions
SzNagyMisucommented, Jan 16, 2020

Good one! Thanks @Shinigami92!

I added

module.exports = {
  // ...
  globals: {
    'vue-jest': {
      pug: { doctype: 'html' }
    }
  }
}

to my jest.config.js and now it works as expected.

4reactions
Shinigami92commented, Jan 16, 2020

IMO this should be the default

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the new v-slot directive in Vue.js - VueDose
Simplify the use of scoped slots with the new v-slot syntax introduced in Vue.js 2.6.0 beta 3.
Read more >
vue Dynamic Slot Names Error Templates should only be ...
I am using Vuejs(2.6.11) Dynamic Slot Names Eerror: Templates should only be responsible for mapping the state to the UI.
Read more >
'Unrecognized Slot name' error on v-slot:header declaration
For locally declared components the named slots are behaving without errors. Also, the project is using Vue 2.6.12 while WebStrorm says 2.6.0 ....
Read more >
vue-server-renderer | Yarn - Package Manager
2.7.14 (2022-11-09). Bug Fixes. compiler-sfc: fix template usage check edge case for v-slot destructured default value (#12842 (5e3d4e9), closes #12841 ...
Read more >
Table | Components - BootstrapVue
This may cause GUI issues such as sub components/elements that are ... When using the new Vue 2.6 v-slot syntax, note that slot...
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