kailong321200875 / vue-element-plus-admin

A backend management system based on vue3, typescript, element-plus, and vite
https://element-plus-admin.cn/
MIT License
2.8k stars 677 forks source link

构建出现问题 #264

Closed 18696232390 closed 1 year ago

18696232390 commented 1 year ago

执行pnpm run build:pro后,出现问题,正常启动没问题

SyntaxError: At least one <template> or <script> is required in a single file component. at Object.parse$4 [as parse] (D:\code\xx-culture\xx-culture-web\node_modules\.pnpm\@vue+compiler-sfc@3.2.47\node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:5269:21) at createDescriptor (D:\code\xx-culture\xx-culture-web\node_modules\.pnpm\@vitejs+plugin-vue@4.0.0_vite@4.1.4+vue@3.2.47\node_modules\@vitejs\plugin-vue\dist\index.cjs:68:43) at transformMain (D:\code\xx-culture\xx-culture-web\node_modules\.pnpm\@vitejs+plugin-vue@4.0.0_vite@4.1.4+vue@3.2.47\node_modules\@vitejs\plugin-vue\dist\index.cjs:2210:34) at Object.transform (D:\code\xx-culture\xx-culture-web\node_modules\.pnpm\@vitejs+plugin-vue@4.0.0_vite@4.1.4+vue@3.2.47\node_modules\@vitejs\plugin-vue\dist\index.cjs:2702:16) at file:///D:/code/xx-culture/xx-culture-web/node_modules/.pnpm/rollup@3.19.1/node_modules/rollup/dist/es/shared/node-entry.js:24343:40

18696232390 commented 1 year ago

也没有提示哪个文件有问题,我检查了我的所有文件,都没有重复的使用template或者script

18696232390 commented 1 year ago

@kailong321200875 麻烦协助看一下,功能已经开发好了但是没办法打包上线

kailong321200875 commented 1 year ago

尝试下升级所有依赖 提供下你使用的版本号 @18696232390

18696232390 commented 1 year ago
{
  "name": "vue-element-plus-admin",
  "version": "1.9.4",
  "description": "一套基于vue3、element-plus、typesScript、vite4的后台集成方案。",
  "author": "Archer <502431556@qq.com>",
  "private": false,
  "scripts": {
    "i": "pnpm install",
    "dev": "vite --mode base",
    "ts:check": "vue-tsc --noEmit",
    "build:pro": "vite build --mode pro",
    "build:gitee": "vite build --mode gitee",
    "build:dev": "npm run ts:check && vite build --mode dev",
    "build:test": "npm run ts:check && vite build --mode test",
    "serve:pro": "vite preview --mode pro",
    "serve:dev": "vite preview --mode dev",
    "serve:test": "vite preview --mode test",
    "npm:check": "npx npm-check-updates",
    "clean": "npx rimraf node_modules",
    "clean:cache": "npx rimraf node_modules/.cache",
    "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
    "lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,vue,html,md}\"",
    "lint:style": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
    "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
    "prepare": "husky install",
    "p": "plop",
    "analysis": "windicss-analysis"
  },
  "dependencies": {
    "@iconify/iconify": "^3.1.0",
    "@vueuse/core": "^9.13.0",
    "@wangeditor/editor": "^5.1.23",
    "@wangeditor/editor-for-vue": "^5.1.10",
    "@zxcvbn-ts/core": "^2.2.1",
    "animate.css": "^4.1.1",
    "axios": "^1.3.4",
    "echarts": "^5.4.1",
    "echarts-wordcloud": "^2.1.0",
    "element-plus": "2.2.32",
    "intro.js": "^6.0.0",
    "lodash-es": "^4.17.21",
    "mitt": "^3.0.0",
    "mockjs": "^1.1.0",
    "nprogress": "^0.2.0",
    "pinia": "^2.0.32",
    "qrcode": "^1.5.1",
    "qs": "^6.11.0",
    "url": "^0.11.0",
    "vue": "3.2.47",
    "vue-i18n": "9.2.2",
    "vue-router": "^4.1.6",
    "vue-types": "^5.0.2",
    "web-storage-cache": "^1.1.1"
  },
  "devDependencies": {
    "@commitlint/cli": "^17.4.4",
    "@commitlint/config-conventional": "^17.4.4",
    "@iconify/json": "^2.2.29",
    "@intlify/unplugin-vue-i18n": "^0.8.2",
    "@purge-icons/generated": "^0.9.0",
    "@types/intro.js": "^5.1.1",
    "@types/lodash-es": "^4.17.6",
    "@types/node": "^18.14.2",
    "@types/nprogress": "^0.2.0",
    "@types/qrcode": "^1.5.0",
    "@types/qs": "^6.9.7",
    "@typescript-eslint/eslint-plugin": "^5.54.0",
    "@typescript-eslint/parser": "^5.54.0",
    "@vitejs/plugin-legacy": "^4.0.1",
    "@vitejs/plugin-vue": "^4.0.0",
    "@vitejs/plugin-vue-jsx": "^3.0.0",
    "autoprefixer": "^10.4.13",
    "consola": "^2.15.3",
    "eslint": "^8.35.0",
    "eslint-config-prettier": "^8.6.0",
    "eslint-define-config": "^1.15.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-vue": "^9.9.0",
    "husky": "^8.0.3",
    "less": "^4.1.3",
    "lint-staged": "^13.1.2",
    "plop": "^3.1.2",
    "postcss": "^8.4.21",
    "postcss-html": "^1.5.0",
    "postcss-less": "^6.0.0",
    "prettier": "^2.8.4",
    "rimraf": "^4.1.2",
    "rollup": "^3.17.3",
    "stylelint": "^15.2.0",
    "stylelint-config-html": "^1.1.0",
    "stylelint-config-prettier": "^9.0.5",
    "stylelint-config-recommended": "^10.0.1",
    "stylelint-config-standard": "^30.0.1",
    "stylelint-order": "^6.0.2",
    "terser": "^5.16.5",
    "typescript": "4.9.5",
    "unplugin-vue-define-options": "^1.2.3",
    "vite": "4.1.4",
    "vite-plugin-ejs": "^1.6.4",
    "vite-plugin-eslint": "^1.8.1",
    "vite-plugin-mock": "^2.9.6",
    "vite-plugin-progress": "^0.0.6",
    "vite-plugin-purge-icons": "^0.9.2",
    "vite-plugin-style-import": "2.0.0",
    "vite-plugin-svg-icons": "^2.0.1",
    "vite-plugin-windicss": "^1.8.10",
    "vue-tsc": "^1.2.0",
    "windicss": "^3.5.6",
    "windicss-analysis": "^0.3.5"
  },
  "engines": {
    "node": ">= 14.18.0"
  },
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/kailong321200875/vue-element-plus-admin.git"
  },
  "bugs": {
    "url": "https://github.com/kailong321200875/vue-element-plus-admin/issues"
  },
  "homepage": "https://github.com/kailong321200875/vue-element-plus-admin"
}
kailong321200875 commented 1 year ago
{
  "name": "vue-element-plus-admin",
  "version": "1.9.4",
  "description": "一套基于vue3、element-plus、typesScript、vite4的后台集成方案。",
  "author": "Archer <502431556@qq.com>",
  "private": false,
  "scripts": {
    "i": "pnpm install",
    "dev": "vite --mode base",
    "ts:check": "vue-tsc --noEmit",
    "build:pro": "vite build --mode pro",
    "build:gitee": "vite build --mode gitee",
    "build:dev": "npm run ts:check && vite build --mode dev",
    "build:test": "npm run ts:check && vite build --mode test",
    "serve:pro": "vite preview --mode pro",
    "serve:dev": "vite preview --mode dev",
    "serve:test": "vite preview --mode test",
    "npm:check": "npx npm-check-updates",
    "clean": "npx rimraf node_modules",
    "clean:cache": "npx rimraf node_modules/.cache",
    "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
    "lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,vue,html,md}\"",
    "lint:style": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
    "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
    "prepare": "husky install",
    "p": "plop",
    "analysis": "windicss-analysis"
  },
  "dependencies": {
    "@iconify/iconify": "^3.1.0",
    "@vueuse/core": "^9.13.0",
    "@wangeditor/editor": "^5.1.23",
    "@wangeditor/editor-for-vue": "^5.1.10",
    "@zxcvbn-ts/core": "^2.2.1",
    "animate.css": "^4.1.1",
    "axios": "^1.3.4",
    "echarts": "^5.4.1",
    "echarts-wordcloud": "^2.1.0",
    "element-plus": "2.2.32",
    "intro.js": "^6.0.0",
    "lodash-es": "^4.17.21",
    "mitt": "^3.0.0",
    "mockjs": "^1.1.0",
    "nprogress": "^0.2.0",
    "pinia": "^2.0.32",
    "qrcode": "^1.5.1",
    "qs": "^6.11.0",
    "url": "^0.11.0",
    "vue": "3.2.47",
    "vue-i18n": "9.2.2",
    "vue-router": "^4.1.6",
    "vue-types": "^5.0.2",
    "web-storage-cache": "^1.1.1"
  },
  "devDependencies": {
    "@commitlint/cli": "^17.4.4",
    "@commitlint/config-conventional": "^17.4.4",
    "@iconify/json": "^2.2.29",
    "@intlify/unplugin-vue-i18n": "^0.8.2",
    "@purge-icons/generated": "^0.9.0",
    "@types/intro.js": "^5.1.1",
    "@types/lodash-es": "^4.17.6",
    "@types/node": "^18.14.2",
    "@types/nprogress": "^0.2.0",
    "@types/qrcode": "^1.5.0",
    "@types/qs": "^6.9.7",
    "@typescript-eslint/eslint-plugin": "^5.54.0",
    "@typescript-eslint/parser": "^5.54.0",
    "@vitejs/plugin-legacy": "^4.0.1",
    "@vitejs/plugin-vue": "^4.0.0",
    "@vitejs/plugin-vue-jsx": "^3.0.0",
    "autoprefixer": "^10.4.13",
    "consola": "^2.15.3",
    "eslint": "^8.35.0",
    "eslint-config-prettier": "^8.6.0",
    "eslint-define-config": "^1.15.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-vue": "^9.9.0",
    "husky": "^8.0.3",
    "less": "^4.1.3",
    "lint-staged": "^13.1.2",
    "plop": "^3.1.2",
    "postcss": "^8.4.21",
    "postcss-html": "^1.5.0",
    "postcss-less": "^6.0.0",
    "prettier": "^2.8.4",
    "rimraf": "^4.1.2",
    "rollup": "^3.17.3",
    "stylelint": "^15.2.0",
    "stylelint-config-html": "^1.1.0",
    "stylelint-config-prettier": "^9.0.5",
    "stylelint-config-recommended": "^10.0.1",
    "stylelint-config-standard": "^30.0.1",
    "stylelint-order": "^6.0.2",
    "terser": "^5.16.5",
    "typescript": "4.9.5",
    "unplugin-vue-define-options": "^1.2.3",
    "vite": "4.1.4",
    "vite-plugin-ejs": "^1.6.4",
    "vite-plugin-eslint": "^1.8.1",
    "vite-plugin-mock": "^2.9.6",
    "vite-plugin-progress": "^0.0.6",
    "vite-plugin-purge-icons": "^0.9.2",
    "vite-plugin-style-import": "2.0.0",
    "vite-plugin-svg-icons": "^2.0.1",
    "vite-plugin-windicss": "^1.8.10",
    "vue-tsc": "^1.2.0",
    "windicss": "^3.5.6",
    "windicss-analysis": "^0.3.5"
  },
  "engines": {
    "node": ">= 14.18.0"
  },
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/kailong321200875/vue-element-plus-admin.git"
  },
  "bugs": {
    "url": "https://github.com/kailong321200875/vue-element-plus-admin/issues"
  },
  "homepage": "https://github.com/kailong321200875/vue-element-plus-admin"
}

尝试下升级依赖吧 看不出有什么问题

18696232390 commented 1 year ago

怎么升级呀,方便给个命令不,大佬~

kailong321200875 commented 1 year ago

怎么升级呀,方便给个命令不,大佬~

npm run npm:check

18696232390 commented 1 year ago

升级后,还是同样的错误

PS > pnpm run build:pro

> vue-element-plus-admin@1.9.4 build:pro D:\code\huiju-culture\huiju-culture-web
> vite build --mode pro

Building [███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 27% | Time: 10.8s
Build failed. Please check the error message

 ERROR  error during build:                                                                                                                                                                10:40:43  
SyntaxError: At least one <template> or <script> is required in a single file component.
18696232390 commented 1 year ago

刚刚试了下重新拉了一版,打包,没问题,应该是我这边的问题