发布vue插件在生成是出错ERROR in chunk vendor [initial]
发布于 9个月前 作者 gmars 1392 次浏览 来自 问答

这个是运行npm run build的错误

ERROR in chunk vendor [initial]
vue-map-picker.js
Conflict: Multiple assets emit to the same filename vue-map-picker.js

ERROR in chunk manifest [entry]
vue-map-picker.js
Conflict: Multiple assets emit to the same filename vue-map-picker.js

  Build failed with errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-map-picker@1.4.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-map-picker@1.4.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator.XFTFN95IJP9D0PI\AppData\Roaming\npm-cache\_logs\2017-10-23T05_29_28_094Z-debug.log

这个是我的webpack.json的配置主要修改了main

{
  "name": "vue-map-picker",
  "version": "1.4.0",
  "description": "A Vue.js project",
  "author": "weiyongqiang <hayixia606@163.com>",
  "private": false,
  "main": "dist/vue-map-picker.js",
  "directories": {
    "dist": "dist"
  },
  "scripts": {
    "dev": "node build/dev-server.js",
    "start": "npm run dev",
    "build": "node build/build.js"
  },
  "dependencies": {
    "vue": "^2.5.2",
    "vue-amap": "^0.3.1",
    "vue-router": "^3.0.1",
    "vue-map-picker": "^1.4.0"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-loader": "^7.1.1",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chalk": "^2.0.1",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.0",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.14.1",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "http-proxy-middleware": "^0.17.3",
    "webpack-bundle-analyzer": "^2.9.0",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "opn": "^5.1.0",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "rimraf": "^2.6.0",
    "url-loader": "^0.5.8",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "portfinder": "^1.0.13",
    "webpack": "^3.6.0",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-hot-middleware": "^2.18.2",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

在 webpack.prod.conf.js中修改了output

output: {
    // path: config.build.assetsRoot,
    // filename: utils.assetsPath('js/[name].[chunkhash].js'),
    // chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
    path: config.bundle.assetsRoot,
    publicPath: config.bundle.assetsPublicPath,
    filename: "vue-map-picker.js",
    library: "VueMapPicker",
    libraryTarget: "umd",
    umdNamedDefine: true
  },

修改了entry

entry: {
    app: './src/main.js'
  },

求大神帮助

2 回复

大哥 有没有解决掉 啊 我也遇到了这个问题

已经是伤心欲绝 都开始怀疑人生了

回到顶部