Subscribe on changes!

@vue/compiler-sfc throws error Cannot read properties of undefined (reading 'start')

avatar
Jan 9th 2024

Vue version

3.4.5

Link to minimal reproduction

https://github.com/major-mayer/vue-sfc-compiler-problem

Steps to reproduce

I tried to upgrade my project from VueJs 2 to 3 using the migration build (vue/compat). However, after I did the first necessary steps (until 4) described here: https://v3-migration.vuejs.org/migration-build.html the build was not sucessfull and I wasn't able to resolve it on my own. To reproduce, clone the repo and run "npm install" "npm run serve".

What is expected?

The dev server should start without major problems, that I am not able to resolve on my own (including those coming from vue/compiler-sfc).

What is actually happening?

Upon starting the webpack dev server using npm run serve the logs are filled with this error message for all top level component/ pages:

TypeError: Cannot read properties of undefined (reading 'start')
    at createBlock (/home/user/Checkouts/project/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:1988:31)
    at /home/user/Checkouts/project/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:1910:38
    at Array.forEach (<anonymous>)
    at parse$2 (/home/user/Checkouts/project/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:1854:16)
    at Object.loader (/home/user/Checkouts/project/node_modules/vue-loader/dist/index.js:64:36)
 @ ./src/main.js 2:0-28 4:22-25

The same error was also reported on Stackoverflow recently: https://stackoverflow.com/questions/77758384/vue-vue-compiler-sfc-gives-type-error-while-building-the-project

System Info

System:
    OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
    CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
    Memory: 10.90 GB / 22.30 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Browsers:
    Chrome: 120.0.6099.109
  npmPackages:
    vue: ^3.4.5 => 3.4.5

Any additional comments?

No response

avatar
Jan 9th 2024

fixed by 923d560d0 (out in 3.4.7)

avatar
Jan 9th 2024

Crazy, soo fast :astonished: Thanks a lot! I was scratching my head so hard yesterday, wondering where in the migration process I made the fault. I already debated if I should really report it or if it was just my stupidity, but apparently it made sense ^^