vue3+vite+Eslint: Error [ERR_REQUIRE_ESM]: require() of ES Module

{
  "name": "vite-project",
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "preview": "vite preview",
    "prettier": "prettier --write .",
    "prepare": "husky install",
    "lint": "eslint src --fix --ext .js,.vue"
  },
  "dependencies": {
    "vue": "^3.2.37"
  },
  "devDependencies": {
    "@babel/core": "^7.18.10",
    "@babel/eslint-parser": "^7.18.9",
    "@commitlint/cli": "^17.0.3",
    "@commitlint/config-conventional": "^17.0.3",
    "@typescript-eslint/eslint-plugin": "^5.33.0",
    "@typescript-eslint/parser": "^5.33.0",
    "@vitejs/plugin-vue": "^3.0.3",
    "commitizen": "^4.2.5",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": "^8.22.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-vue": "^9.3.0",
    "husky": "^8.0.0",
    "prettier": "^2.7.1",
    "typescript": "^4.6.4",
    "vite": "^3.0.7",
    "vite-plugin-eslint": "^1.8.0",
    "vue-tsc": "^0.39.5"
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

将 package.json 文件 “type”: “module” 去掉

你可能感兴趣的:(vue.js,javascript,前端)