Skip to content

Commit

Permalink
feat: warn when user modifies output.path directly
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 27, 2018
1 parent 87892a5 commit 81d29ab
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/@vue/cli-service/lib/PluginAPI.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const chalk = require('chalk')
const { matchesPluginId } = require('@vue/cli-shared-utils')

class PluginAPI {
Expand Down Expand Up @@ -114,7 +115,18 @@ class PluginAPI {
* @return {object} Raw webpack config.
*/
resolveWebpackConfig (chainableConfig) {
return this.service.resolveWebpackConfig(chainableConfig)
const config = this.service.resolveWebpackConfig(chainableConfig)
// performa a few warning checks
const options = this.service.projectOptions
if (config.output.path !== this.resolve(options.outputDir)) {
console.error(chalk.red(
`\n\nConfiguration Error: ` +
`Avoid modifying webpack output.path directly. ` +
`Use the "outputDir" option instead.\n`
))
process.exit(1)
}
return config
}

/**
Expand Down

0 comments on commit 81d29ab

Please sign in to comment.