Skip to content
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

While using handlebars-i18n with webpack application, handlebars-loader throws error #30

Open
ags18 opened this issue Jun 22, 2021 · 0 comments

Comments

@ags18
Copy link

ags18 commented Jun 22, 2021

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'),
            ],
          },
        },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant