Handlebars error: 'Handlebars is not defined'

Viewed 72

I'm new to JS and I have problem in my project. I can't load handlebars. I have the same ReferenceError : handlebars is not defined. I've tried also adding handlebars.js file in src folder but it doesn't work. I would appreciate any help. https://github.com/dzgierski19/pizzeria-project

My JS code :

 `const templates = {
    menuProduct: Handlebars.compile(document.querySelector(select.templateOf.menuProduct).innerHTML),
  };`

My HTML

  `<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.1.0/handlebars.min.js"></script>
`

handlebars error

1 Answers

Have you tried to change the handlebars version? You're using version 4.1.0, but handlebars it's already on version 4.7.7 Theirs any reason to use such an old version? If you need to use this version, take a look at this version docs to check if it's available and if the methods you're using are right.

At the official doc the say to use @latest version enter image description here

https://handlebarsjs.com/guide/#installation

Related