bem/bem-xjst

generate method is broken

qfox opened this issue · 1 comments

qfox commented

In v7:

$ npm i bem-xjst@7
bem-xjst@7.7.4 node_modules/bem-xjst
$ node -p "require('bem-xjst').bemhtml.generate()" > out-v7.js
$ node -p "require('./out-v7.js').apply({block:'qwe'});"
<div class="qwe"></div>

In v8:

$ npm i bem-xjst@8
bem-xjst@8.6.11 node_modules/bem-xjst
node -p "require('bem-xjst').bemhtml.generate()" > out-v8.js
[eval]:1
require('./out-v8.js').apply({block:'qwe'});

But at the same time:

$ node -p "require('./out-v8.js'); global.bemhtml.apply({block:'qwe'});"
<div class="qwe"></div>

Perhaps it should not work like this and put bemhtml variable into the global.

I've made a PR for testing CJS: #457

Fixed in #457