Vue-cli: Some files go to default `dist` directory location after changing it via chainWebpack

Created on 5 Apr 2018  路  3Comments  路  Source: vuejs/vue-cli

Version

3.0.0-beta.6

Reproduction link

https://github.com/NathanKleekamp/vue-dist-bug-min-repro

Steps to reproduce

  1. Create a directory. In the linked repo, I chose otherLocation
  2. Add a vue.config.js file with this content: https://github.com/NathanKleekamp/vue-dist-bug-min-repro/blob/master/vue.config.js
  3. Run npm run build

What is expected?

All the build assets should go to the newly defined dist directory.

What is actually happening?

About half the files go to otherLocation, but the favicon, manifest.json, and images go to the default dist location.


Thanks for all your hard work on this wonderful framework!

bug now

All 3 comments

Not 100% sure if it is desired to have the output.path cause the webpack-copy-plugin to option be overridden. If not, the solution is to set your outputDir to the relative path (so otherLocation in your scenario) or you can further customize your webpack config from your example with

config
    .plugin('copy')
    .tap(args => {
      args[0][0].to = distPath
      return args
    })

If it is desired to have a customized output.path be sent/forwarded onto the config for the webpack-copy-plugin I can look into doing that.

That's why you should specify the directory using outputDir instead of directly mutating the webpack config. The outputDir needs to be available as the internal webpack config is being created.

We should probably find a way to add warnings when the user attempts to modify options that they should not be modifying... in particular anything under output.

Was this page helpful?
0 / 5 - 0 ratings