BBVAEngineering / ember-cli-workbox

Offline caching as a progressive enhancement using service workers
MIT License
20 stars 11 forks source link

[BUG] ember generate fails when ember-cli-workbox is installed #106

Closed Alonski closed 2 years ago

Alonski commented 4 years ago

Hello,

In one of my ember apps whenever ember g ... is run I get this error:

➜  App git:(branch) ember g service locale         
installing service
Cannot read property 'options' of undefined

Debugging this I found that this fails:

  - stack: TypeError: Cannot read property 'options' of undefined
    at Class.config (/App/node_modules/ember-cli-workbox/index.js:16:31)

The line in question: https://github.com/BBVAEngineering/ember-cli-workbox/blob/master/index.js#L15

this.app is undefined for some reason while ember g is run causing it to fail. Config from environment.js:

 workbox: {
            // Configures workbox to only precache SVG images.
            swDest: "/service-workers/sw.js",
            globPatterns: ["**/*.svg"],
            globDirectory: "./images",
            modifyURLPrefix: {
                "": "images/"
            }
        },

Is anything else needed to debug this?

adrigzr commented 2 years ago

:tada: This issue has been resolved in version 3.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: