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.

error: Expected "class" but found "const" in Vite2

See original GitHub issue

I tried switch vite version to 1.0rc, it’s fine, but error on 2.0 And if no “@Options”, it’s fine too, but how can i include components

image package.json

"dependencies": {
    "vue": "3.0.5"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^1.0.4",
    "@vue/compiler-sfc": "^3.0.5",
    "@vuedx/typecheck": "^0.4.1",
    "@vuedx/typescript-plugin-vue": "^0.4.1",
    "sass": "^1.32.2",
    "typescript": "^4.1.3",
    "vite": "^2.0.0-beta.10",
    "vue-class-component": "^8.0.0-rc.1"
  }

App.vue

<script lang="ts">
// import { defineComponent } from 'vue'  
import HelloWorld from './components/HelloWorld.vue';  

import { Vue, Options } from 'vue-class-component';  

@Options({  
	components: {  
		HelloWorld,  
	},
})  
export default class App extends Vue {

}
</script>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ktsncommented, Jan 12, 2021

This is more like Vite transpile issue.

0reactions
lgl017commented, Jan 12, 2021

I found same issue in vite here: https://github.com/vitejs/vite/issues/1476

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: Expected "class" but found "const" in Vite2 - Bountysource
I tried switch vite version to 1.0rc, it's fine, but error on 2.0. And if no "@Options", it's fine too, but how can...
Read more >
Error: Unexpected "<" in Vite Vue in JS files - Stack Overflow
ResourceCenterIcon.jsx export const resourceCenterIcon = <svg>...</svg>. Then import it, and use like a component:
Read more >
Features | Vite
Most libraries expect "useDefineForClassFields": true , such as MobX, Vue Class Components 8.x, etc. But a few libraries haven't transitioned to this new ......
Read more >
Asset Bundling (Vite) - The PHP Framework For Web Artisans
Have you started a new Laravel application using our Vite scaffolding but need ... Within a fresh installation of Laravel, you will find...
Read more >
Getting Started with Vitest | Vue Mastery
Vitest uses the same configuration as Vite, and shares a common ... Vitest also allows for extra configuration which can be found in...
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