Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR Invalid options in vue.config.js: "build" is not allowed. "dev" is not allowed

Tags:

vue.js

vue-cli

I have an existing vue-cli 2 app that I'm attempting to upgrade to vue-cli-3. After adding my unique dependencies, I dropped src/ right into the newly created vue-cli-3 app and started up. woot!

How do I manage [PROD|DEV|TEST].env.js now that we use vue.config.js?

I got the following error because my first attempt to create a vue.config.js was to simply rename config/index.js to be /vue.config.js and keep the existing /config/[PROD|DEV|TEST].env.js but I got the following error:

ERROR  Invalid options in vue.config.js: "build" is not allowed. "dev" 
is not allowed error Command failed with exit code 1.

I don't understand how environments are now managed.

Thanks for your time!

like image 309
DaveWoodall.com Avatar asked Apr 12 '18 22:04

DaveWoodall.com


1 Answers

May be you should use devServer instead. And for build I guess there is another name now.

For example:

module.exports = {
  devServer: {
   // your settings
  }
}

For example:

module.exports = {
  devServer: {
    proxy: {
      '/api': {
        target: '<url>',
        ws: true,
        changeOrigin: true
      },
      '/foo': {
        target: '<other_url>'
      }
    }
  }
}

Reference: vue-cli

like image 108
xianshenglu Avatar answered Nov 15 '22 13:11

xianshenglu