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

tree.match is not a function #519

Closed
ineptian opened this issue Aug 9, 2021 · 4 comments
Closed

tree.match is not a function #519

ineptian opened this issue Aug 9, 2021 · 4 comments

Comments

@ineptian
Copy link

ineptian commented Aug 9, 2021

  • Maizzle Version: 3.6.1
  • Node.js Version: 15.5.0
  • Windows 10

When installing a new maizzle project, and running maizzle serve I get met with the following error:
Failed to compile template: transactional.html
tree.match is not a function

If I delete transactional.html, it will throw the error on promotional.html instead and vice versa.

Any ideas what could be causing this? Maizzle has worked for me previously so not sure exactly what the deal is. All the packages get installed without any errors. Would love to use maizzle on a new project I have coming up.

Thanks.

@cossssmin
Copy link
Member

Crap, it’s probably the latest update to PostHTML. I’ll publish a patch today so we go back to locking dependency versions, it’s already the second time something like this happens.

@cossssmin
Copy link
Member

Can confirm, it's posthtml-expressions:

TypeError: tree.match is not a function
    at scriptDataLocals (C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-expressions\lib\locals.js:25:8)
    at C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-expressions\lib\index.js:160:24
    at C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\lib\index.js:1:2017   
    at Array.reduce (<anonymous>)
    at applyPluginsToTree (C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\lib\index.js:1:1989)
    at C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\lib\index.js:1:1603   
    at C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\node_modules\posthtml\lib\api.js:91:45
    at traverse (C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\node_modules\posthtml\lib\api.js:105:26)
    at Array.match (C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\node_modules\posthtml\lib\api.js:90:7)
    at handleExtendsNodes (C:\Users\Cosmin\Desktop\test-tree\node_modules\posthtml-extend\lib\index.js:1:1262)

@Scrum I suppose this is coming from the latest 1.8.0 release, any ideas? This is how we're applying posthtml-expressions in Maizzle:

layouts(
merge(
{
strict: false,
plugins: [
expressions({...expressionsOptions, locals})
]
},
layoutsOptions
)
),

@cossssmin
Copy link
Member

cossssmin commented Aug 10, 2021

@ineptian I published 3.6.2, reinstall Maizzle (delete node_modules and package-lock.json, run npm install again) and it'll work. We'll publish another patch release once we sort this out, thanks a lot for reporting it 👍

@cossssmin
Copy link
Member

Fixed in posthtml-expressions@1.8.1, you can update Maizzle to 3.7.0 and it'll work as expected now.

Thanks @Scrum for the speedy fix 🚀

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

2 participants