Javascript Vue Cli 3生产构建失败,而开发构建工作正常

Javascript Vue Cli 3生产构建失败,而开发构建工作正常,javascript,vue.js,production,Javascript,Vue.js,Production,我有一个VueJS应用程序,它是用VueCLI 3搭建的,我想部署它。使用npm-run-serve运行的开发版本运行良好,一切正常。但是当使用npm运行build然后使用service-s dist运行时,我会遇到大量错误。其中一些错误是: Error: "Unable to find required dependency e" TypeError: "this.userDataStorage is undefined" TypeError: "this.user is undefined

我有一个VueJS应用程序,它是用VueCLI 3搭建的,我想部署它。使用
npm-run-serve运行的开发版本运行良好,一切正常。但是当使用
npm运行build
然后使用
service-s dist
运行时,我会遇到大量错误。其中一些错误是:

Error: "Unable to find required dependency e"
TypeError: "this.userDataStorage is undefined"
TypeError: "this.user is undefined
Unhandled promise rejection TypeError: "t.auth is undefined"
这就像生成的dist包可能遗漏了什么,我不知道哪里出了问题,或者遗漏了什么。我们将非常感谢您为解决此问题提供的任何帮助。可能是一个依赖项(比如vue inject,我用它作为IoC框架)可能是罪魁祸首

下面分别是我的
packages.json
vue.config.js

{
  "name": "myapp",
  "description": "",
  "keywords": [],
  "version": "0.1.0",
  "dependencies": {
    "bootstrap": "3.3.2",
    "d3": "^5.7.0",
    "d3-gantt-chart": "^0.2.8",
    "d3-layout-timeline": "^1.0.3",
    "d3-transition": "^1.1.1",
    "d3plus-text": "^0.9.32",
    "foundation-sites": "^6.5.0-rc.3",
    "jquery": "^3.3.1",
    "jquery-ui": "^1.12.1",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.11",
    "tinycolor": "latest",
    "underscore": "^1.9.1",
    "vue": "^2.5.17",
    "vue-formio": "^3.0.1",
    "vue-inject": "^2.1.1",
    "vue-router": "^3.0.1",
    "vue-slider-component": "^2.8.0",
    "vuejs-datepicker": "^1.5.3",
    "vuex": "^3.1.0",
    "what-input": "^5.1.2"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.3.0",
    "@vue/cli-plugin-e2e-nightwatch": "^3.3.0",
    "@vue/cli-plugin-eslint": "^3.3.0",
    "@vue/cli-plugin-unit-jest": "^3.3.0",
    "@vue/cli-service": "^3.3.1",
    "@vue/eslint-config-prettier": "^4.0.1",
    "@vue/test-utils": "^1.0.0-beta.28",
    "ajv": "^6.5.3",
    "axios": "^0.18.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^23.6.0",
    "babel-runtime": "^6.26.0",
    "bootstrap-sass": "^3.3.7",
    "css-loader": "^1.0.1",
    "eslint": "^5.12.1",
    "eslint-config-prettier": "^3.6.0",
    "eslint-config-standard": "^12.0.0",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-loader": "^2.1.1",
    "eslint-plugin-html": "^5.0.0",
    "eslint-plugin-import": "^2.15.0",
    "eslint-plugin-node": "^8.0.1",
    "eslint-plugin-prettier": "^3.0.1",
    "eslint-plugin-promise": "^4.0.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^5.1.0",
    "husky": "^1.3.1",
    "lint-staged": "^8.1.0",
    "node-sass": "^4.11.0",
    "sass-loader": "^7.1.0",
    "script-loader": "^0.7.2",
    "stylelint": "^9.10.1",
    "stylelint-config-sass-guidelines": "^5.3.0",
    "stylelint-config-standard": "^18.2.0",
    "vue-drag-drop": "^1.1.4",
    "vue-hot-reload-api": "^2.3.0",
    "vue-template-compiler": "^2.5.17",
    "vue2-dropzone": "^3.5.2"
  },
  "author": "devops@myapp.io",
  "contributors": [],
  "license": "Unlicense",
  "readmeFilename": "Readme.md",
  "repository": {
    "type": "git",
    "url": ""
  },
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "test:e2e": "vue-cli-service test:e2e",
    "test:unit": "vue-cli-service test:unit"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.js": [
      "vue-cli-service lint",
      "git add"
    ],
    "*.vue": [
      "vue-cli-service lint",
      "git add"
    ],
    "*.css": [
      "stylelint --fix",
      "git add"
    ],
    "*.scss": [
      "stylelint --syntax=scss",
      "git add"
    ]
  }
}

您有很多开发依赖项,听起来像prod依赖项,比如vue drag drop、axios..@Phiter我尝试过将所有内容都放入依赖项中,而不是devdependency中,但没有效果。同样的错误也会出现。
var webpack = require("webpack");
var path = require("path");

module.exports = {
  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        jquery: "jquery"
      })
    ],
    resolve: {
      extensions: [".js", ".vue", ".json"],
      alias: {
        jquery: "jquery/src/jquery.js",
        "jquery-ui": "jquery-ui",
        d3: "d3",
        modules: path.join(__dirname, "node_modules")
      }
    }
  }
};