-
Notifications
You must be signed in to change notification settings - Fork 547
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
global is undefined in strict mode #324
Comments
Sorry for the delay. I think the reason there is so much ceremony around a simple Without using if (console && console.warn) {
// ..snip...
} If there is a way to perform this check without being broken by strict mode? |
if ((typeof console !== 'undefined') && console.warn) {
// ...
} |
fixes lunr error olivernn/lunr.js#324
* add file references to ensure concat order * remove strict modes fixes lunr error olivernn/lunr.js#324
will this be addressed any time soon? |
Fixes olivernn#324 (allowing lunr.js import as module and usage in other strict environments) by switching lunr itself to strict mode and fixing `this` usage. `wrapper_end` was updated to the latest version of template, which uses `self` to access window and thus works in strict mode. `lurn.utils.warn` was changed as in olivernn#411 Tests added work both in Node and browser.
I'm using lunr with es6 syntax which need babel to compile. but babel will always enable the strict mode which will make an error in following source code:
this
in strict mode will be undefined instead of thewindow
object .By the way, I don't understand why using
global.console
instead ofconsole
, is it necessary for some edge case?The text was updated successfully, but these errors were encountered: