Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.4.0 (from 5.3.0) breaking change? (config.html[platform] || []).map is not a function #268

Closed
rosskevin opened this issue May 23, 2019 · 7 comments · Fixed by #269
Closed

Comments

@rosskevin
Copy link

Just updated from 5.3.0 to 5.4.0 - using via app-manifest-webpack-plugin

I'm wondering if there was a breaking change and semver wasn't followed for it? I looked at https://github.com/itgalaxy/favicons/releases and checked for a changelog but there isn't a file.

Error: Module build failed (from /project/node_modules/app-manifest-webpack-plugin/lib/favicons.js):
TypeError: (config.html[platform] || []).map is not a function
    at createHTML (/project/node_modules/favicons/dist/index.js:118:54)
    at createPlatform (/project/node_modules/favicons/dist/index.js:135:85)
    at /project/node_modules/favicons/dist/index.js:161:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/project/node_modules/favicons/dist/index.js:35:103)
    at _next (/project/node_modules/favicons/dist/index.js:37:194)
    at /project/node_modules/favicons/dist/index.js:37:364
    at new Promise (<anonymous>)
    at /project/node_modules/favicons/dist/index.js:37:97
    at _create (/project/node_modules/favicons/dist/index.js:190:20)
    at create (/project/node_modules/favicons/dist/index.js:139:20)

Thoughts? Is this a problem with usage for the webpack plugin instead?

@ahukkanen
Copy link
Contributor

I am experiencing exactly the same issue.

This is apparently originating from this PR:
https://github.com/itgalaxy/favicons/pull/260/files

And from this commit:
ad4816c#diff-1fdf421c05c1140f6d71444ea2b27638

Caused by this line:

return Promise.all((config.html[platform] || []).map(µ.HTML.render));

I debugged the value of config.html[platform] and it looks like this:

{ "link[rel='shortcut icon'][href$='favicon.ico']": "<link rel='shortcut icon' href='favicon.ico'>",
  "link[rel='icon'][type='image/png'][sizes='16x16'][href$='favicon-16x16.png']":
   "<link rel='icon' type='image/png' sizes='16x16' href='favicon-16x16.png'>",
  "link[rel='icon'][type='image/png'][sizes='32x32'][href$='favicon-32x32.png']":
   "<link rel='icon' type='image/png' sizes='32x32' href='favicon-32x32.png'>" }

So, it is actually an object, not an array. Therefore it does not have the .map() method.

@ahukkanen
Copy link
Contributor

It seems those files are coming from here:
https://github.com/itgalaxy/favicons/blob/ad4816c20603f00e183721f9ddfb0c59e1afa2fb/src/config/html.js

This works OK when it is loaded, like during the tests.

However, the npm package itself still ships with a file named src/config/html.json. This is breaking the package as it is expecting to load the html.js file from the config dir.

As a remediation, you can install favicons through the GitHub tag:

$ npm install itgalaxy/favicons#v5.4.0

This must be something related to the build process that builds the package to be sent to npm. The old generated dist folder needs to be removed before re-generating a release because some files may have been deleted.

@ahukkanen
Copy link
Contributor

#269 should fix this issue.

A new release is obviously needed after those changes are applied.

@alexander-akait
Copy link
Member

/cc @brunocodutra regression?

@brunocodutra
Copy link
Collaborator

Woops my bad - I'll release 5.4.1 today which should fix (thanks @ahukkanen!) this issue

@meabed
Copy link

meabed commented May 26, 2019

Woops my bad - I'll release 5.4.1 today which should fix (thanks @ahukkanen!) this issue

would you kindly release this now :)
Thanks

@brunocodutra
Copy link
Collaborator

The release PR (#271) is blocked waiting for review approval.

/cc @evilebottnawi

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

Successfully merging a pull request may close this issue.

5 participants