Search code examples
node.jspatternlab.io

How to fix the error of Maximum call stack size exceeded when using pattern lab?


In pattern lab Maximum call stack size exceeded error and I don't know why. I'm not doing anything that I haven't done before.

In 01-molecules/02-cart/cart.mustache I have this code

{{#miniCart}}
<div class="mini_cart_item">
    <img class="mini_cart_image" src={{img}} alt="">
    <div class="mini_cart_info">
        <span>£{{price}}</span>
        <h4 class="mini_cart_title">{{title}}</h4>
    </div>
</div>
{{/miniCart}}

That data comes from 01-molecules/02-cart/cart.json. It works fine.

Then I have 02-organisms/mini-cart.mustache and the code is

<div class="mini_cart">
{{#miniCart}}
{{> cart}}
{{/miniCart}}
</div>

The cart comes from the molecule above, the data comes from 02-organisms/mini-cart.json. Is is the some json code just with more objects.

That {{> cart}} throws the Maximum call stack size exceeded error. If I remove that line of code and replace it with anything, like {{title}} the code just works.

What might be the problem?


To run pattern lab I am running this

/MyMAMP/www/2016/edition-node-gulp/node_modules/gulp/bin/gulp.js patternlab:serve

From google search I tried this

/MyMAMP/www/2016/edition-node-gulp/node_modules/gulp/bin/gulp.js patternlab:serve --stack_size=2048

but the result is the same thing.


Solution

  • Maintainer of Pattern Lab Node here.

    {{> cart}} should be {{> molecules-cart}}

    Give that a shot.