Hao Wu
Hao Wu

Reputation: 20669

Vue CLI Service production build without version code?

I have a vue project and I use vue-cli-service build to build the project for production.

I noticed by default when I build the files, the resource name are having some kind of version code like

app.34fc5700.js
chunk-vendors.c7da5824.js

Is there a way to get rid of it?

I'm using vue.config.js, there's no webpack.conf.js in my project, and this is how it looks like:

module.exports = {
    publicPath: process.env.VUE_APP_ROOT_PATH,
    outputDir: process.env.VUE_APP_BUILD_DIR,
    chainWebpack: config => {
        config.resolve.symlinks(false);
        config.plugin('html').init((Plugin, args) => {
            const newArgs = {
                ...args[0],
            };
            newArgs.minify && (newArgs.minify.removeAttributeQuotes = false);
            return new Plugin(newArgs);
        });
    },
    css: {
        loaderOptions: {
            sass: {
                additionalData: '@import "@/scss/_variables.scss";',
            },
        },
    }
}

Upvotes: 1

Views: 1039

Answers (1)

tmhao2005
tmhao2005

Reputation: 17504

Looks like the option filenamehashing is something you need. Basically this option is enabled by default so you might need to turn it off:

// vue.config.js
module.exports = {
  filenameHashing: false,
  // ...
};

Upvotes: 1

Related Questions