Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.log.bind(console) still being removed #493

Closed
motss opened this issue Apr 6, 2017 · 2 comments
Closed

console.log.bind(console) still being removed #493

motss opened this issue Apr 6, 2017 · 2 comments

Comments

@motss
Copy link

motss commented Apr 6, 2017

Description

PR#421 still does not solve the problem that console.log.bind(console) is still being removed after the build.

Consider the simple script below:

// Using `debug`.
const Debug = require('debug');

const debug = Debug('test-debug');

debug.log = console.log.bind(console);
debug.error = console.error.bind(console);
.babelrc

  • {
      "comments": false,
      "presets": [
        [ "env", { "targets": { "node": "current" } } ],
        "babili"
      ],
      "plugins": [
        "transform-remove-console"
      ]
    }

package.json

  • "devDependencies": {
      "babel-cli": "^6.14.0",
      "babel-plugin-transform-remove-console": "^6.8.0",
      "babel-polyfill": "^6.16.0",
      "babel-preset-babili": "0.0.12",
      "babel-preset-env": "^1.1.8",
    }

Expected output after babili:

'use strict';
const Debug=require('debug'),debug=Debug('test-debug');
debug.log=console.log.bind(console),debug.error=console.error.bind(console);

Actual output after babili:

'use strict';
const Debug=require('debug'),debug=Debug('test-debug');
debug.log=function(){},debug.error=function(){};
@hzoo
Copy link
Member

hzoo commented Apr 6, 2017

Hey @motss! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@boopathi
Copy link
Member

boopathi commented Apr 6, 2017

You're using transform-remove-console in your plugins which is supposed to remove console.* statements or nullify the effect of console.* statements and is working as expected.

You can avoid using transform-remove-console plugin in your babelrc and babili should not remove the console.* statements by default.

@boopathi boopathi closed this as completed Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants