11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.19k stars 494 forks source link

beforeBuild and afterBuild events not run on Netlify build #1472

Closed f-elix closed 4 years ago

f-elix commented 4 years ago

Describe the bug I use the build events beforeBuild and afterBuild in my pipeline to process my assets, and they are working great when I run a local build, but they are not getting fired when the command is run by Netlify.

I inserted console logs at several steps to keep track of the build process. I can see the messages printed on my local console but can't see any in the Netlify deploy logs. Moreover, my assets are dependant on the code that runs in those events to be inserted in the final build folder, and they are not in said folder once Netlify is done.

To Reproduce Steps to reproduce the behavior:

  1. Use eleventy events (ideally with console logs)
  2. Run a local build and notice the events are called properly
  3. Deploy the repo on Netlify
  4. Look at the Netlify logs and final output, and notice the events weren't called

Expected behavior The events should be run both locally and on Netlify.

Environment:

binyamin commented 4 years ago

@f-elix You might want to try https://community.netlify.com first. That's their support community. Also, can you link to the repo that's causing you trouble?

f-elix commented 4 years ago

Sure, here you go: https://github.com/f-elix/eleventy-starter

I'll ask in the Netlify forum and will let you know if I find anything.

f-elix commented 4 years ago

I got no answer on the Netlify community forum, but I was able to deploy the repo successfully on Vercel, with all the build events getting called.

I'm closing this issue as this is clearly an issue with Netlify.

Thanks!

f-elix commented 3 years ago

UPDATE:

I found out what the problem was with Netlify.

I was setting the NODE_ENV variable to 'production' in my site settings. As per Netlify's docs, when that's the case, Netlify won't install the devDependencies during the build process (why that is, I cannot understand). Since Eleventy was in my devDependencies (among other things), nothing was being built with my actual setup.