vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
68.09k stars 6.13k forks source link

vite build error #12063

Closed Jacky10000 closed 1 year ago

Jacky10000 commented 1 year ago

Describe the bug

My project uses vue3+vite+js+ts: it is an old project which use vite + vue3+js,recently I developed some new modules with typescript,it can run normal when use 'npm run dev' cammand,but when I use 'vite build', it reports errors like this: [vite:esbuild] Transform failed with 1 error: /components/quotedPrice/index.vue?vue&type=script&setup=true&lang.ts:2:5: ERROR: Expected ">" but found "class" Expected ">" but found "class"

<template>
<div class="price">
<div @click="onClick">

I think this error is not accurate, because if i delete class, it will be 'Expected ">" but found "@"'

Reproduction

none

Steps to reproduce

none

System Info

node: v16.18.0;npm:8.19.2
"pinia": "2.0.23",
    "vant": "3.6.4",
    "vue": "3.2.41",
    "vue-router": "4.1.5",
"@rollup/plugin-inject": "5.0.2",
    "@rushstack/eslint-patch": "1.2.0",
    "@types/node": "^18.11.18",
    "@vitejs/plugin-legacy": "2.3.1",
    "@vitejs/plugin-vue": "3.1.2",
    "@vitejs/plugin-vue-jsx": "2.0.1",
    "@vue/eslint-config-prettier": "7.0.0",
    "@vue/test-utils": "2.1.0",
    "afc-scss-base": "0.0.6",
    "autoprefixer": "10.4.12",
    "babel-eslint": "10.1.0",
    "babel-plugin-import": "1.13.5",
    "cnjm-postcss-px-to-viewport": "1.0.0",
    "compressing": "1.6.2",
    "eslint": "8.26.0",
    "eslint-plugin-vue": "9.6.0",
    "fast-glob": "3.2.12",
    "jsdom": "20.0.1",
    "klinecharts": "8.6.3",
    "lodash-es": "4.17.21",
    "node-sass": "7.0.3",
    "numeral": "2.0.6",
    "postcss-flexbugs-fixes": "5.0.2",
    "prettier": "2.7.1",
    "protobufjs": "6.10.2",
    "rollup-plugin-esbuild": "4.10.2",
    "rollup-plugin-web-worker-loader": "1.6.1",
    "sass": "1.55.0",
    "sass-loader": "13.1.0",
    "sass-resources-loader": "2.2.5",
    "start-server-and-test": "1.14.0",
    "terser": "5.15.1",
    "ts-loader": "^8.4.0",
    "typescript": "^4.9.4",
    "unplugin-auto-import": "0.11.4",
    "unplugin-vue-components": "0.22.9",
    "vant": "3.6.4",
    "vconsole": "3.14.7",
    "vite": "3.1.8",
    "vite-plugin-comlink": "^3.0.4",
    "vite-plugin-svg-icons": "2.0.1",
    "vite-plugin-vconsole": "^1.2.2",
    "vitest": "0.23.4",
    "vuedraggable-es": "4.1.1"

Used Package Manager

npm

Logs

No response

Validations

github-actions[bot] commented 1 year ago

Hello @Jacky10000. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

emosheeep commented 1 year ago
<template>
  <div class="price">
  <div @click="onClick">

Did you add </template> Tag? It seems that your template is invalid

Jacky10000 commented 1 year ago
<template>
  <div class="price">
  <div @click="onClick">

Did you add </template> Tag? It seems that your template is invalid

no,beacuse I just show a little codes, if I delete all codes, just like this<template><div></div></template>,it will report the tempalte tag is error