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.debug are not transpiled in ES6+ version #2216

Closed
Nightmaster opened this issue Feb 25, 2020 · 1 comment
Closed

console.debug are not transpiled in ES6+ version #2216

Nightmaster opened this issue Feb 25, 2020 · 1 comment
Labels

Comments

@Nightmaster
Copy link
Contributor

Nightmaster commented Feb 25, 2020

Stencil version:

 @stencil/core@1.8.6

I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
console.debug is not transpiled in ES6+ versions

Expected behavior:
console.debug should be transpiled and not deleted

Steps to reproduce:

See code below

Related code:

export namespace LoggingService {
  let logLevel: LogLevel

  export const trace = (message?: unknown, ...optionalParams: unknown[]): void => {
    if (LogLevel.TRACE >= logLevel) {
      console.trace(message, ...optionalParams)
    }
  }

  export const debug = (message?: unknown, ...optionalParams: unknown[]): void => {
    if (LogLevel.DEBUG >= logLevel) {
      console.debug(message, ...optionalParams)
    }
  }

  export const log = (message?: unknown, ...optionalParams: unknown[]): void => {
    if (LogLevel.LOG >= logLevel) {
      console.log(message, ...optionalParams)
    }
  }

  // Higher levels implementation come here (logic is exactly the same)

  export const initLogLevel = (level: LogLevel): void => {
    if (!logLevel && !! level)
      logLevel = level
  }
}

export enum LogLevel {
  TRACE = 0,
  DEBUG = 1,
  LOG = 2,
  // Higher levels come here
}

is transpiled in this:

var n, e
!function (o) {
  let t
  o.trace = (o, ...n) => {
    e.TRACE >= t && console.trace(o, ...n)
  }, o.debug = () => {
    // Problem is here!
  }, o.log = (o, ...n) => {
    e.LOG >= t && console.log(o, ...n)
  }
  // [...]
  }, o.initLogLevel = o => {
    !t && o && (t = o)
  }
}(n || (n = {})), function (o) {
  o[o.TRACE = 0] = 'TRACE', o[o.DEBUG = 1] = 'DEBUG', o[o.LOG = 2] = 'LOG'/**[...]*/
}(e || (e = {}))

Other information:
The same thing happens everywhere when console.debug is called

@ionitron-bot ionitron-bot bot added the triage label Feb 25, 2020
adamdbradley added a commit that referenced this issue Feb 25, 2020
@adamdbradley
Copy link
Contributor

Just updated it so console.debug will not get removed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants