How to disable source map or debug mode in production Vue.js - Webpack

Viewed 17111

I am working on a Vue.js project and all files are generated by webpack on dev and production mode.

but here is my problem :

I can see my vue components in devtools when I inspect on a element.

How could I disable that ?

By the way source map is disabled and I have no .map files in dist folder. Here is my devtools and as you can see vue components are showed

thank you :)

2 Answers

Just checkout the Vue cli docs:

productionSourceMap Type: boolean

Default: true

Setting this to false can speed up production builds if you don't need source maps for production.

So in your webpack config you write:

module.exports = {
  productionSourceMap: false
};

If your vue.config.js which is responsible for your webpack configuration doesn't exist, you may create it.

If webpack has been configured from scratch, it can be removed by deleting or commenting in any case in the webpack production file the devtool option

tools/webpack.prod.js



    module.exports = merge(common, {
      // devtool: "source-map",
      mode: "production",
      ...
    });


Related