Customizing the build in Vue CLI GUI

Posted by Lemeechi on 2019-06-05 02:21:06 in Discovery Vue Journal (489 views)

1904291

The Configuration menu of the GUI lets you change the options used when building for production. In an earlier post I wondered where the dist directory where the build files were kept was defined. This is the answer: You can see from the image that the default Public Path is / while the Output directory is dist. Make the Public Path empty string (for current directory) instead of / so all items are linked using relative paths, resulting in an application that will work from any directory it is placed. The Save changes button shows up once you make a change, and the settings are saved in the vue.config.js file in the project directory, which you can also edit manually. Changing the above two options will create a file with content similar to the following:

module.exports = {
  publicPath: '',
  outputDir: 'myapp'
 }

Be aware that each time you Save changes only the most recent changes you made since the last save are saved and any existing vue.config.js will be overwritten.

Changing Enable Production Source Maps (further down) to false means no .map files will be produced for each .js file during the build. When I did the build without .map files, the total directory size after the build dropped from about 836 KB to 150 KB. The 3 non-CLI files earlier created totaled only 9 KB excluding the four referenced files, or about 426 KB including the referenced files.

Summary

The Configuration menu of the Vue CLI GUI lets you change the options used when building for production. The settings are saved in the vue.config.js file in the project directory, which you can also edit manually.

If you like this post please register or log in to be able to subscribe and be notified of new posts by Lemeechi.

 

Tags

2019    June 2019    Lemeechi    Vue    Vue build configuration    Vue CLI GUI    VueJS   

Comments

No comments yet.

Add Comment

(All values are required.)

 (Will not be published.)

Similar Posts

The Vue JS crash course by Traversy  |   Converting the Todo Vue CLI app to plain HTML/JavaScript/CSS version  |   Enhancing the plain HTML Todo app  |   Deploying the Todo app to the web  |   Discovery Vue Journal: Getting Started!  |   The Vue introductory tutorial video  |  

 Close
Tweet