React-markdown: Webpack build error with mdast-add-list-metadata package.json added in react-markdown v3.4.0

Created on 25 Jul 2018  路  5Comments  路  Source: remarkjs/react-markdown

I had previously been using v3.3.4

Failed to compile.
static/js/main.acb28e42.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [./~/mdast-add-list-metadata/index.js:4,0]

Going to roll back and see if that works now, but wanted to share.

Most helpful comment

I've added a post-build script that will run the whole thing through uglify-js (the non-ES6 one) to verify that it works as expected, so hopefully this should never happen again.

All 5 comments

I was also getting an error due to this library mdast-add-list-metadata. using create-react-app this library causes problems because of this issue:
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

In our case it was failing to minify the library as it has ES6, so we roll back to a previous version of react-markdown not linking that library. I removed the caret from the package in the package.json.

It's not the most efficient, but it worked til we figure something else

@queuebit, maybe we could change the title to reference that the issue is due to the library itself... the commit updating it has been done today, so it's pretty recent and it looks like it could have an easy fix.

Oh, that's unfortunate. I'll push a fix asap.

Luckily some good samaritan had already sent a PR to make the dependency in question use ES5, so all I had to do was update a minimum version range. Really sorry about this, will see if I can add some infrastructure to make sure it all builds on ES5-only features.

Fixed in 3.4.1.

I've added a post-build script that will run the whole thing through uglify-js (the non-ES6 one) to verify that it works as expected, so hopefully this should never happen again.

Was this page helpful?
0 / 5 - 0 ratings