How do I disable running an app on the local network when using vue-cli?
To disable running an app on the local network when using vue-cli, you can follow these steps:
Step 1: Open the vue.config.js file
- In your project's root directory, locate the
vue.config.js
file. If it doesn't exist, create a new file with that name.
Step 2: Add the devServer configuration
- Inside the
vue.config.js
file, add the following code to configure the development server:
module.exports = {
devServer: {
host: 'localhost',
disableHostCheck: true,
},
};
- This code sets the
host
option to'localhost'
and thedisableHostCheck
option totrue
. This configuration allows the app to run only on the localhost and disables the host check.
Step 3: Save the changes
- Save the
vue.config.js
file.
That's it! With these steps, you have disabled running the app on the local network when using vue-cli. Now, the app will only be accessible on the localhost.