K
K
Kerm2021-08-23 20:05:06
npm
Kerm, 2021-08-23 20:05:06

Npm, error when starting devBuild, Unexpected token, why does it swear?

You may need an additional loader to handle the result of these loaders.
| 
|   async created() {
>     if (this.$route.params?.page) {
|       this.onChangePage(this.$route.params.page);
|     }


If you remove the question mark, then everything starts fine, I can not understand what is the reason. The question mark is needed there, because parameters may or may not be present.

{
  "name": "first-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test": "jest"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "vue"
    ],
    "transform": {
      ".*\\.(vue)$": "<rootDir>/node_modules/vue-jest",
      "^.+\\.js$": "<rootDir>/node_modules/babel-jest"
    },
    "collectCoverage": true,
    "collectCoverageFrom": [
      "**/*.{js,vue}",
      "!**/node_modules/**",
      "!coverage/**"
    ]
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^2.6.11",
    "vue-router": "^3.5.2",
    "vuex": "^3.6.2"
  },
  "devDependencies": {
    "@babel/core": "^7.14.3",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/test-utils": "1.2.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "babel-jest": "26.6.3",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "jest": "26.6.3",
    "node-sass": "^6.0.1",
    "sass": "^1.26.5",
    "sass-loader": "^8.0.2",
    "vue-jest": "^3.0.7",
    "vue-template-compiler": "^2.6.11"
  }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question