Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Vue 3 Project Bundling

Vue 3 Project Bundling

When you are ready to publish your application to production, you need to bundle the Vue project.

Bundle the Vue project using the following command:

npm run build

After running the above command, the output is as follows:

After execution, a dist directory is generated under the Vue project; it generally contains an index.html file and a static directory, which includes static files js, css, and an images directory (if there are images).

If you double-click to open index.html directly, the page may appear blank in the browser; to display it normally you need to modify the js and css file paths in index.html.

For example, when we open dist/index.html we see the css and js file paths are absolute paths:







...

We change the js and css file paths to relative paths:







...

This way, double-clicking dist/index.html will display the result in the browser.