You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Installed the plugin as a dev dependency by: npm i -D babel-plugin-transform-remove-console
Then modified babel.config.js:
module.exports=(api)=>{varenv=api.cache(()=>process.env.NODE_ENV);varplugins=[];// Change to 'production' when configs are workingif(env==='development'){plugins.push(['transform-remove-console',{exclude: ['error','warn']}]);}return{presets: ['@vue/cli-plugin-babel/preset'],// plugins,// Doesn't work even when always on?plugins: ['transform-remove-console'],};};
Add some console.log() and console.warn() lines in your componen etc runtime code.
What is expected?
Running npm run serve -- --reset-cache and build command with different environments should drop console loggings.
What is actually happening?
I've also tried building the app many times with different environments, but the console loggings are still showing up in the browser's console.
Actually, now that I created this bug reproduction repo, the plugin is working there!
However I cannot figure out what is causing it not to work in my real application. I've also tried nuking npm cache by npm cache clean --force...
Another way would be to configure this with a Webpack plugin instead. However, Babel has this plugin in-built.
The text was updated successfully, but these errors were encountered:
I found out that my recent NPM packages upgrades had been interrupted and had not been fully successful. There was some Vue CLI plugins that had different versions.
After nuking node_modules folder and upgrading all the packages this Babel plugin started working!
Version
4.2.2
Reproduction link
github.com/ux-engineer/bug-repro-vue-cli-4-babel-preset-with-custom-plugin
Environment info
Steps to reproduce
Installed the plugin as a dev dependency by:
npm i -D babel-plugin-transform-remove-console
Then modified
babel.config.js
:Add some
console.log()
andconsole.warn()
lines in your componen etc runtime code.What is expected?
Running
npm run serve -- --reset-cache
and build command with different environments should drop console loggings.What is actually happening?
I've also tried building the app many times with different environments, but the console loggings are still showing up in the browser's console.
Actually, now that I created this bug reproduction repo, the plugin is working there!
However I cannot figure out what is causing it not to work in my real application. I've also tried nuking npm cache by
npm cache clean --force
...Another way would be to configure this with a Webpack plugin instead. However, Babel has this plugin in-built.
The text was updated successfully, but these errors were encountered: