Giter Club home page Giter Club logo

Uncaught TypeError: Object #<Object> has no method 'merge' about grunt-contrib-handlebars HOT 9 CLOSED

gruntjs avatar gruntjs commented on June 13, 2024
Uncaught TypeError: Object # has no method 'merge'

from grunt-contrib-handlebars.

Comments (9)

w33ble avatar w33ble commented on June 13, 2024

Just experienced the same thing on a new project.

node 0.10.7
grunt 0.4.1
grunt-contrib-handlebars 0.5.9
handlebars 1.0.0-rc.4 (via Bower)

UPDATE: I tried grabbing the latest handlebars (1.0.0) from the website and it worked.

After a little digging, it looks like the problem is caused by Handlebars 1.0.12. When I set the version to 1.0.11, it works. So the issue (sort of) is this package's reliance on "handlebars": "~1.0.10", which pulls down 1.0.12. Ultimately, this seems like a Handlebars issue though, not really something wrong with this package.

UPDATE 2: According to this issue, 1.0.0 is required to use the 1.0.12 build.

from grunt-contrib-handlebars.

dominicphillips avatar dominicphillips commented on June 13, 2024

We had the same issue. We pulled the runtime from the handlebars site and it was working again.

from grunt-contrib-handlebars.

ma-jahn avatar ma-jahn commented on June 13, 2024

Hi!

We were experiencing the same.
Via npm shrinkwrap we were able to force grunt-contrib-handlebars to use handlebars 1.0.10 instead of 1.0.12.

from grunt-contrib-handlebars.

sabarasaba avatar sabarasaba commented on June 13, 2024

Hi, same thing happend to us, we fixed it using @KK-MarcelJahn solution.

from grunt-contrib-handlebars.

w33ble avatar w33ble commented on June 13, 2024

The 1.0.0 runtime is required to use pre-compiled templates with built with 1.0.12. If you're having issues, update your client side version.

from grunt-contrib-handlebars.

jackcviers avatar jackcviers commented on June 13, 2024

@w33ble Updating the client-side when you output as an npm module for, say, browserify, makes absolutely no difference whatsoever. The require statement in the output templates.js file still says require('handlebars'); when options: node === true.

I can confirm that this issue is not fixed.

For reference, here is my handlebars grunt config:

    handlebars:
      main:
        options:
          wrapped: true
          namespace: 'com.banno.clientlib.templates'
          node: true
          processName: (filename) ->
            filenameRegex = ///(?:.*/)*(.*)(?:\.handlebars$)///
            filenameRegex.exec(filename)[1]
        files: [
          src:
            [
              'src/main/handlebars/*.handlebars'
              'src/main/handlebars/**/*.handlebars'
              'src/main/handlebars/**/**/*.handlebars'
              'src/main/handlebars/**/**/**/*.handlebars'
            ]
          dest:
            'dist/templates.js'
        ]

I use browserify to build my applications. It walks the require tree and creates a nice wrapped environment for you so that your application can be completely modular in the browser without using an external loader.

So when require is called, the version of handlebars included in the grunt-contrib-handlebars package matters. I attempted to fix this by using [email protected] However, there is still a problem, because grunt-contrib-handlebars isn't including the modular handlebars runtime. Any help is appreciated.

from grunt-contrib-handlebars.

w33ble avatar w33ble commented on June 13, 2024

I haven't used browserify before, so I don't know what the issue would be. I suspect that it's not a problem with the grunt plugin, but I could be wrong. According to the issue that was opened in handlebars (see above), they only test things against the packaged versions. In this case, 1.0.12 and 1.0.0 (final). If you mix a match, things will probably break, as they did here.

Maybe opening an issue in the handlebars repo would shed some light on your issue?

from grunt-contrib-handlebars.

creatorrr avatar creatorrr commented on June 13, 2024

The issue is in the handlebars bower component repo. It's still referenccing old dependency versions. Sent a pull request to fix it.

from grunt-contrib-handlebars.

kyledetella avatar kyledetella commented on June 13, 2024

@w33ble – Updating the runtime to 1.0.0 did the trick. Thanks!

from grunt-contrib-handlebars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.