Lesson 21 - gulp-imagemin is now an ES Module
ComedyTomedy opened this issue · comments
Lesson 21 doesn't work, at least for me. I thought I'd open an issue, if only to reassure people who are having the same issue.
Unless there's another version, it seems gulp-imagemin has moved from CommonJS to modern ES Modules. This means the image optimisation can't be mixed with the non-module gulpfile.
If the course moves from Gulp to NPM Scripts this won't be an issue any more.
For now, and probably the next year or two, 11ty doesn't support ES Modules, cf. eleventy#836.
The quick fix is to pin an old version of gulp-imagemin, specifically "7.1.0". I suggest we change the install command to:
npm install gulp-imagemin@7.1.0 --save-exact
I've tested this and it fixes the problem. --save-exact
is useful to avoid the site breaking if someone runs npm update
.
I'll be bold and make a PR with this change. It fixes the problem, seems like the only solution for now, and even if we find something better later, the course will be unbroken in the meantime.