javascriptnode.jsvue.jsgithubvue-cli-3

Prevent vue cli from deleting all files in dist


I am developing vue project and syncing dist folder with git. This worked well while using webpack. However, I have moved to @vue/cli --- using vue create myProject instead of vue init webpack myProj.

The issue is that every time i run npm run build, it deletes dist folder and recreates it -- all .git and other files gone.

How do I prevent new build from deleting required files in dist folder and only update the changes?


Solution

  • Thanks to answer by Yom S. the documentation here does provide way to keep older dist.

    However, the you can't use --no-clean like npm build --no-clean. To use no clean mode from terminal you need to write following command instead

    ./node_modules/.bin/vue-cli-service --no-clean
    

    Update

    Instead you can also add --no-clean in package.json