The application of Uglify to eliminate console logs can be inconsistent in its effectiveness

Having some trouble with my Vue3 app. I've implemented UglifyJS to remove console.logs in production environments, but it seems to be inconsistent. Sometimes it works fine, other times not so much. Every time I have to rebuild and hope for the best. Is there a configuration issue that I'm overlooking?

//vue.config.js
const UglifyJSPlugin = require("uglifyjs-webpack-plugin")
.
.
.
configureWebpack: config => {
    //added for local testing purposes
    if (process.env.NODE_ENV === "development") { 
        // configure for production...
        config.optimization.minimizer = [
            new UglifyJSPlugin({
                test: /\.vue(\?.*)?$/i,
                uglifyOptions: {
                    compress: {
                        drop_console: true
                    }
                }
            })
        ]
    }
}

The removal of console.logs seems to work inconsistently. Most logs are hidden, but sometimes they still appear. Any ideas on what might be missing from my setup?

Answer №1

Collaborated with a Vue developer from their platform to solve this particular issue.

The problem can be resolved by setting "productionSourceMap: true" in your Vue configuration file.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

unable to execute a node.js demonstration

When attempting to run a pre-existing example in the node.js environment, I consistently encounter the error message: "Cannot find module '/build/default/validation'" Could it be possible that I forgot to install a certain module using npm? ...

Using VueJS to pass objects as props

My current project involves building controllers for sets of items. I am creating a Javascript object with functions and storing it in the data of the Vue instance. This object is then passed using: <dynamic-table :table-object="objTable"></dynami ...

Encountering an error message stating "Assertion failed: (thread_id_key != 0x7777)" in the find_thread_id_key function within the coroutine.cc file at line 134 while attempting to run npm start

After encountering ERR! Code 426 when trying to login with npm, I took the following steps: $npm cache clean --force $rm -rf node_modules package-lock.json $npm install The npm install was successful with a 200 OK response. However, when attempting to ...

File index with Node.js server for handling files

I currently have a code snippet for setting up a file server that serves files from a static folder named "public1". However, I am facing difficulties in making an HTML page display by default when a user navigates to the IP address in a browser. Although ...

How can I create an input field that only reveals something when a specific code is entered?

I am currently developing a website using HTML, and I would like to create an admin section that requires a password input in order to access. After consulting resources on w3schools, I attempted the following code: <button onclick="checkPassword()" i ...

Informing the parent window of the child window's activities in order to adjust the timer for the user timeout feature

Within my Jquery function, I have implemented a feature that darkens the screen after a period of user inactivity. This triggers a pop-up window giving the user the option to stay logged in by clicking a button. If there is no response within the set time ...

What is the best way to open a browser window at a quarter of its default size?

Is there a way to open a window at 25% of its default device browser window size? I attempted the code below, which worked. However, it only accepts pixel inputs and not relative % values. This makes it non-scalable across various devices. window.resizeT ...

Encountering a "dependency resolution error" while deploying a React application with Parcel on Heroku

I've developed a compact application and I'm in the process of deploying it to Heroku. However, I keep encountering an error stating: '@emotion/is-prop-valid' dependency cannot be resolved. It's worth mentioning that this project d ...

Calculating date discrepancies with JavaScript

Two fields are present, one for the start date and one for the end date. I would like to display the date difference in another text box when the user selects dates from a date picker. Although I have made some progress on this, I believe that there are st ...

The only thing visible on my project is the homepage, void of any buttons or additional pages

After completing this school project, I believed that everything was done correctly. However, as I faced issues with the code, I decided to seek help and share my app.js and bin section for clarification. Starting it with npm on the localhost as shown in ...

In what format is the parameter accepted by the .getDay() method?

Here's the plan: I need to extract information from an input element with type set as date. This data will then be stored in a .json file and later parsed when the program is initiated. Subsequently, I aim to utilize the date.getDay() function to dete ...

Why is it impossible for me to delete the class / property of this object?

Within a series of nested divs, there are additional divs containing multiple imgs. The goal is to cycle through these images using CSS transitions. To achieve this, a JavaScript object was created to track the divs, sub-divs, and images. Three arrays were ...

The behavior of having two submit buttons within the $document.ready(function) in Jquery

In my code, I have implemented the behavior of two buttons, button1 and button2, within a $(document).ready(function). Whenever either button is clicked, an alert() function should be triggered. However, it seems that only button2 is functioning properly w ...

Using plain JavaScript (without any additional libraries like jQuery), you can eliminate a class from an element

I'm attempting to locate an element by its class name, and then remove the class from it. My goal is to achieve this using pure JavaScript, without relying on jQuery. Here is my current approach: <script> var changeController = function() { ...

Using the history.push() method from the Action Creator will update the URL without actually redirecting to a new page

I have a login page component that I've set up to redirect to another page after a successful login. However, even though the URL changes correctly, the page remains on the Login page. First, let me show you how I import the history module to be used ...

What is the best way to create a mirror effect on one div by clicking another div?

I have created a schedule grid and I am looking for a way to allow users to click on the UK hour and then have the corresponding U.S time highlighted. Is there a CSS solution for this? The functionality I need is to be able to select multiple hours. I have ...

Using the power of jQuery and Ajax to smoothly transition to a different page after editing the value of

Displaying a MySQL table named demo with the values Peter and John along with edit links Example Peter EDIT John EDIT When the edit link is clicked, it will open the page edit_name.php. In edit_name.php, you can update the clicked value using the updat ...

The zsh is indicating a permission denial following the npm linking process

I've been attempting to execute a simple CLI command but encountered a permission denied error after running npm link: zsh: permission denied: testcom The contents of file myfile are: #!/usr/local/bin/ node console.log('Hello!') When I ...

Extracting data from string in object form

Values are stored as JSON objects in my database. After retrieving these values, the result is: '["{ zone :1, cat_id : 1, subcat : 2}","{ zone :1, cat_id : 2, subcat : 2}","{ zone :1, cat_id : 2, subcat : 3}"]' I then convert it to an array us ...

The auto search feature seems to be malfunctioning after clicking the button

Despite my best efforts, I am still unable to resolve this issue. I have tried numerous links and code snippets, but I am encountering some difficulty in finding a solution. THE ISSUE: I have an input field with type 'Text' for searching employ ...