Closed kompolom closed 8 years ago
Обновить версию bem-xjst?
@kompolom, вот пример конфига, обрати внимание на секцию templateEngine
и scripts
.
specs.configure({
destPath: 'desktop.specs',
levels: ['common.blocks'],
sourceLevels: levels.concat('libs/bem-pr/spec.blocks'),
jsSuffixes: ['vanilla.js', 'browser.js', 'js'],
depsTech: require('enb-bem-techs').deps,
langs: true,
scripts: ['https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js'],
templateEngine: {
templateTech: require('enb-bemxjst/techs/bemhtml'),
templateOptions: { sourceSuffixes: ['bemhtml', 'bemhtml.js'] },
htmlTech: require('enb-bemxjst/techs/bemjson-to-html'),
htmlTechOptionNames: { bemjsonFile: 'bemjsonFile', templateFile: 'bemhtmlFile' }
}
Что-то не пойму. Такая же проблема возникает при обновлении на bem-components@v5 и bem-core@v4. Пробовал в сборку добавить
scripts: ['https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js'],
templateEngine: {
templateTech: require('enb-bemxjst/techs/bemhtml'),
templateOptions: { sourceSuffixes: ['bemhtml', 'bemhtml.js'] },
htmlTech: require('enb-bemxjst/techs/bemjson-to-html'),
htmlTechOptionNames: { bemjsonFile: 'bemjsonFile', templateFile: 'bemhtmlFile' }
}
таже ошибка...
необходимо добавить engineOptions : { elemJsInstances : true }
, т.к. начиная с bem-core v4 появилась поддержка JS у элементов.
@tadatuta сейчас такой конфиг
config.module('enb-bem-specs').createConfigurator('specs').configure({
destPath : 'common.specs',
levels : [].concat(project),
sourceLevels : [].concat(specs, libs, project),
jsSuffixes : ['vanilla.js', 'browser.js', 'js'],
depsTech : techs.bem.depsOld,
scripts : ['https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js'],
templateEngine : {
bemtreeTemplateTech : require('enb-bemxjst/techs/bemtree'),
templateTech : require('enb-bemxjst/techs/bemhtml'),
templateOptions : {
sourceSuffixes : ['bemhtml', 'bemhtml.js'],
engineOptions : { elemJsInstances : true }
},
htmlTech : require('enb-bemxjst/techs/bemjson-to-html'),
htmlTechOptionNames : { bemjsonFile : 'bemjsonFile', templateFile : 'bemhtmlFile' }
}
});
выпадает ошибка
...
15:00:09.370 - [failed] [common.specs/validation_card/validation_card.spec.js] borschik
15:00:09.371 - [failed] [common.specs/validation_length/validation_length.spec.js] borschik
15:00:09.372 - [failed] [common.specs/validation_numbers/validation_numbers.html] bemjson-to-html
15:00:09.372 - [failed] [common.specs/validation/validation.html] bemjson-to-html
15:00:09.372 - [failed] [common.specs/validation_required/validation_required.spec.js] borschik
15:00:09.372 - [failed] [common.specs/validation_email/validation_email.browser.template.js] bemhtml
15:00:09.372 - [failed] [common.specs/validation_money/validation_money.browser.template.js] bemhtml
15:00:09.373 - [failed] [common.specs/validation_numbers/validation_numbers.pre.spec.js] file-merge
15:00:09.373 - [failed] [common.specs/validation/validation.pre.spec.js] file-merge
15:00:09.373 - [failed] [common.specs/validation_pattern/validation_pattern.pre.spec.js] file-merge
15:00:09.374 - build failed
SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at doRequire (/home/sergey/projects/bem-forms/node_modules/enb-async-require/lib/async-require.js:23:30)
at /home/sergey/projects/bem-forms/node_modules/enb-async-require/lib/async-require.js:35:9
at Object.Promise (/home/sergey/projects/bem-forms/node_modules/vow/lib/vow.js:308:9)
Убрал
sourceSuffixes : ['bemhtml', 'bemhtml.js']
, собралось. Но теперь другая проблема
Failed to start mocha: Init timeout
на всех тестах
@belozyorcev правильный конфиг для bem-core v4 можно посмотреть в https://github.com/bem/bem-components/commit/f427fc39fb8e3ad4cc56e417c794f3d1d4dcb3fd Он совершенно точно работает.
@tadatuta вроде завелоь.
Сейчас правда борюсь с Error: Module "spec": can't resolve dependence "i-bem-dom"
вроде что-то нашёл https://github.com/bem/bem-components/issues/1565
Error: Seems like you have no base templates from i-bem.bemhtml
Подскажите куда копать?