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

RotatingFileStream is undefined in strict mode #231

Closed
sudhakar opened this issue Mar 5, 2015 · 1 comment
Closed

RotatingFileStream is undefined in strict mode #231

sudhakar opened this issue Mar 5, 2015 · 1 comment

Comments

@sudhakar
Copy link

sudhakar commented Mar 5, 2015

I am trying to use RotatingFileStream as one of the streams in the new project. Since RotatingFileStream is defined inside the if(mv) conditional, it is getting undefined even if mv is available when used in strict mode.

Note that I need to enable strict mode globally by using --use_strict v8 flag (this is required for classes & block level support)

Instead of hiding the whole function definition inside if(which gets hoisted & removed in strict mode), I propose changing the visibility using module exports

if(mv) {
  module.exports.RotatingFileStream = RotatingFileStream;
}
sudhakar added a commit to sudhakar/node-bunyan that referenced this issue Mar 30, 2015
Defining RotatingFileStream constructor behind ```If```` conditional, fails in ```strict``` mode, `firefox` & `browserify`. See trentm#231, trentm#223 & trentm#236
trentm added a commit that referenced this issue Sep 7, 2015
Should fix usage with bundles including bunyan and using strict mode.
Had to fix a surprise effect that 'window === this' is no longer
true in strict mode:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
"""That means, among other things, that in browsers it's no longer
possible to reference the window object through this inside a strict
mode function."""

Fixes #236, #231, and #223.
@trentm
Copy link
Owner

trentm commented Sep 7, 2015

Should be fixed in v1.5.0.

@trentm trentm closed this as completed Sep 7, 2015
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

2 participants