pastelsky / bundlephobia

🏋️ Find out the cost of adding a new frontend dependency to your project
https://bundlephobia.com
MIT License
8.96k stars 221 forks source link

BuildError for react-metatags-hook #161

Open lordgiotto opened 5 years ago

lordgiotto commented 5 years ago

Type

Bug: react-metatags-hook fails to build returning a generic BuildError error.

Package name

react-metatags-hook

Entire error (stringified) I see in my browser console

{
  "error": {
    "code": "BuildError",
    "message": "Failed to build this package.",
    "details": {
      "name": "BuildError"
    }
  }
}

Thanks :)

pastelsky commented 5 years ago

This happens because terser (the js minifier) cannot parse the file published under dist/index.es.js. Try it here –

https://xem.github.io/terser-online/

It fails with the error SyntaxError: Unexpected token: keyword (export) for the export statement on the last line. Adding a semi-colon before the start of the export statement fixes this. This is probably an ASI edge-case, or probably a bug you should open with terser.