handlebars-i18n
handlebars-i18n copied to clipboard
While using handlebars-i18n with webpack application, handlebars-loader throws error
Getting following error when https://github.com/Aller-Couleur/handlebars-i18n/blob/master/examples/browser-example/index.html is used with webpack application
Html Webpack Plugin:
Error: Child compilation failed:
Module build failed (from ./node_modules/handlebars-loader/index.js):
Error: Parse error on line 137:
...img/{{#if (localeIs \'en\')}}united_king
-----------------------^
Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRI NG', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID'
- parser.js:267 Parser.parseError
[carbon-for-ibm-dotcom-web-components-test]/[handlebars]/dist/cjs/handlebars/compiler/parser.js:267:19
- parser.js:336 Parser.parse
[carbon-for-ibm-dotcom-web-components-test]/[handlebars]/dist/cjs/handlebars/compiler/parser.js:336:30
- base.js:46 parseWithoutProcessing
[carbon-for-ibm-dotcom-web-components-test]/[handlebars]/dist/cjs/handlebars/compiler/base.js:46:33
- base.js:52 HandlebarsEnvironment.parse
[carbon-for-ibm-dotcom-web-components-test]/[handlebars]/dist/cjs/handlebars/compiler/base.js:52:13
- index.js:205 compile
[carbon-for-ibm-dotcom-web-components-test]/[handlebars-loader]/index.js:205:18
Suggest changes required to the following file - config\webpack.config-helper.js
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.hbs$/,
loader: 'handlebars-loader',
query: {
partialDirs: [
path.join(__dirname, '../src', 'layouts'),
path.join(__dirname, '../src', 'pages'),
],
},
},