Skip to content

Lesson 21 - gulp-imagemin is now an ES Module #24

Open

Description

@ComedyTomedy

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.

Activity

  1. ComedyTomedy commented on Feb 19, 2022

    @ComedyTomedy
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions