Skip to content

How to set runtime options #192

Open
@aromot

Description

@aromot

Hello,

I've just updated handlebars to version 4.7.1. I get several errors in the console which look like:

Handlebars: Access has been denied to resolve the property "format" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details

This comes from recent changes done in v. 4.7. I'd like to change my webpack loader config to use the documented runtime options (allowProtoPropertiesByDefault and allowProtoMethodsByDefault). I've tried:

module: {
  rules: [
    // few other loaders...
    {
      test: /\.hbs$/, 
      loader: 'handlebars-loader', 
      query: {
          precompileOptions: {
            allowProtoPropertiesByDefault: true,
            allowProtoMethodsByDefault: true
          },
       helperDirs: [path.join(__dirname, 'src/view/helpers')]
      }
    }
  ]
}

But I still get the same problem. How to set these runtime options?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions