Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

vue3中按需引入vant的toast后,打包后警告:
image.png

因为是警告,就没有注意,然后上到了服务器上,发现报错:
image.png

也不知道警告和报错有没有关系,有没有大佬能帮帮我

以下是部分代码配置

// main.js
import { Dialog, Toast } from 'vant'


app.config.globalProperties.$dialog = Dialog
app.config.globalProperties.$toast = Toast
app.use(router).use(Dialog).use(Toast).mount('#app')
// babel.config.js
module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ],
  plugins: [
    ['import', {
      libraryName: 'vant',
      libraryDirectory: 'es',
      style: true
    }, 'vant']
  ]
}
{
  "name": "customer-view",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "build-test": "vue-cli-service build --mode test"
  },
  "dependencies": {
    "axios": "^0.21.1",
    "babel-plugin-import": "^1.13.3",
    "core-js": "^3.8.1",
    "mockjs": "^1.1.0",
    "moment": "^2.29.1",
    "vant": "^3.0.3",
    "vue": "^3.0.4",
    "vue-jsonp": "^2.0.0",
    "vue-router": "^4.0.1",
    "vuex": "^4.0.0-0",
    "weixin-js-sdk": "^1.6.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/eslint-parser": "^7.12.1",
    "@vue/cli-plugin-babel": "~5.0.0-alpha.2",
    "@vue/cli-plugin-eslint": "~5.0.0-alpha.2",
    "@vue/cli-plugin-router": "~5.0.0-alpha.2",
    "@vue/cli-plugin-vuex": "~5.0.0-alpha.2",
    "@vue/cli-service": "~5.0.0-alpha.2",
    "@vue/compiler-sfc": "^3.0.4",
    "@vue/eslint-config-standard": "^6.0.0",
    "eslint": "^7.15.0",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-vue": "^7.2.0",
    "style-resources-loader": "^1.4.1",
    "stylus": "^0.54.8",
    "stylus-loader": "^4.3.1"
  }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...