Closed mykolaharmash closed 8 years ago
@snater It should not be a global
in node environment.
/cc @blond
@arikon then defineAsGlobal
is pointless in node. How should I define I18N for global BEM? Passing globals: 'force'
to tech doesn't work either, because var BEM;
added as first line.
In global scope this is reference to module.exports not to global
It is not true:
this === global // true
this === module.exports // false
@snater, can you give me a real example?
How should I define I18N for global BEM? Passing globals: 'force' to tech doesn't work either, because var BEM; added as first line.
BEM will be provide to global.BEM
in case of using option exports: { globals: 'force' }
. See https://github.com/snater/enb-bem-i18n/blob/master/techs/i18n.js#L106.
Docs for option exports.
Sorry, I mean module scope, not global
// test-module.js
console.log(this === global);
console.log(this === module.exports);
node -e "require('./test-module.js')"
false
true
@snater Thanks!
In global scope
this
is reference tomodule.exports
not toglobal