Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove webpack:// from sources in the browser

I am using this webpack template for a Vue.JS website.

I deployed the app and it works well, but if you go to developer tools > Sources in Chrome, then under webpack:// you can see the components and the whole code. Is there a way to get rid of that? Or is this usual if you use webpack?

Thank you.

like image 340
Bertie92 Avatar asked Mar 04 '18 14:03

Bertie92


2 Answers

That's because webpack generates source maps which show the original source code and structure.

For the webpack template, you should look for the config/index.js file,

and in order to skip the source map generation change productionSourceMap to false:

module.exports = {
  dev: {
    (...)
  },

  build: {
  
    (...)

    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: '#source-map',

    (...)
  }
}
like image 55
yuriy636 Avatar answered Nov 13 '22 02:11

yuriy636


if you are using vue-cli and have a vue.config.js file then you can simply just add it like this

module.exports = {
    productionSourceMap: false,
}
like image 38
afolabiabass Avatar answered Nov 13 '22 00:11

afolabiabass