Vue CLI: Using a custom domain
Vue CLI defaults to a localhost URL. This quick change allows a custom domain to be used instead
The server will typically be found at something like 'localhost:8080'.
It is nicer to have a URL relating to the project to work with locally, and can be less confusing if running a Vue front-end, with something else providing the API.
To configure this, create a file named 'vue.config.js' in the project root (on the same level as 'package.json', this file doesn't exist by default). Add the following to it, replacing 'projectname.local' with the local URL you want to use:
Next, edit your hosts file and add a new entry for the URL.
On Windows this is usually found at: 'C:/Windows/system32/drivers/etc/hosts'
On Mac/Linux this is at: '/etc/hosts'
You may need to run your text-editor as an admin/superuser to edit this file.
Add this entry to the bottom of the file, replacing 'projectname.local' with your local URL:
Now run 'npm run serve' and it will now be running at your new domain: