Open DarshanVirdi opened 2 years ago
ignore, found a work around without using any other plugin
Hi @DarshanVirdi, terser-webpack-plugin for drop_console is no longer working with latest @vue/cli-plugins version 5.x.x as might be because of migration to webpack 5 from webpack 4 version. Even I tested with the latest terser-webpack-plugin version for webpack 5 its not working. It might be issue with either vue cli plugins or terser-webpack-plugin. What work around you done to remove the console.log.
Hi Jayesh,
implemented consolehandler.js as follows:
function overrideconsole() {
var consoleHolder = window.console;
var console = {};
Object.keys(consoleHolder).forEach(function (key) {
console[key] = function () {};
});
window.console = console;
}
export { overrideconsole };
call from app.vue
if (process.env.NODE_ENV === 'production') {
consolehandler.overrideconsole();
}
As mentioned earlier, this is just a workaround, do let me know, if you have an other way to actully remove the console statement from the production build.
i had resolved this problem by add this to configureWebpack
devtool:
process.env.NODE_ENV === "production"
? undefined
: "eval-cheap-module-source-map",
Hi Jayesh,
I have tried using the teresa plugin to remove the console.log from production build, but no success so far.
Following is my project vue.config.js
Following is the package.json:
Can point out what am I missing?
Thank you, Darshan