Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Not wotking with Eleventy > 1.0.0 #35

Open
genemars opened this issue Oct 28, 2021 · 3 comments
Open

Not wotking with Eleventy > 1.0.0 #35

genemars opened this issue Oct 28, 2021 · 3 comments

Comments

@genemars
Copy link

In latest Eleventy builds the finish method was removed from Eleventy class, so this plugin is not working anymore.
Any plan to upgrade it?
Thanks.

@genemars
Copy link
Author

This is the new code for eleventy-plugin-pwa/.eleventy.js file that seems to work with latest version of Eleventy.

const shimmer = require("shimmer");
const Eleventy = require("@11ty/eleventy/src/Eleventy");

module.exports = {
  configFunction: (cfg, options = {}) => {
    process.on("unhandledRejection", (reason) => {
      console.log("Reason: " + reason);
    });
    function postBuild() {
      shimmer.wrap(Eleventy.prototype, "logFinished", function(orig) {
        return function() {
          const swBuild = require("./src/builder");
          swBuild(options, cfg.dir.output).then((res) => console.log(res));
          return orig.apply(this);
        };
      });
    }
    setImmediate(postBuild);
  }
};

@jmsalazardev
Copy link

This is the new code for eleventy-plugin-pwa/.eleventy.js file that seems to work with latest version of Eleventy.

const shimmer = require("shimmer");
const Eleventy = require("@11ty/eleventy/src/Eleventy");

module.exports = {
  configFunction: (cfg, options = {}) => {
    process.on("unhandledRejection", (reason) => {
      console.log("Reason: " + reason);
    });
    function postBuild() {
      shimmer.wrap(Eleventy.prototype, "logFinished", function(orig) {
        return function() {
          const swBuild = require("./src/builder");
          swBuild(options, cfg.dir.output).then((res) => console.log(res));
          return orig.apply(this);
        };
      });
    }
    setImmediate(postBuild);
  }
};

Hi, did you try creating a new PR?
This package seems to be forgotten :(

@lwojcik
Copy link

lwojcik commented Feb 16, 2023

I forked this plugin, updated it to work with native eleventy.after event that is present since Eleventy v1.0.0 and I'm intending to maintain the fork of mine for as long as I have at least one 11ty website around: https://www.npmjs.com/package/eleventy-plugin-pwa-v2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants