6

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!

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

excellent ! solved my problem and my port variable is set inside vue.config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.