rss-parser: create-react-app can't minify parser.js
Hi there,
Having a problem with the library building from create-react-app from v3.0.0 onwards. 2.12.1 is fine. On running npm run build, I get:
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/rss-parser/lib/parser.js:16
Read more here: http://bit.ly/2tRViJ9
Looks like an ES5/ES6 issue?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 3
- Comments: 22 (5 by maintainers)
@nikomc0 encounter the same issue while using create-react-app.
What I did to solve around is to import the pre-compiled version directly and use the
RSSParserinstead ofParseand I also have to declare eslint global namespace to avoid the create-react-app build errors.also, I tried to add module property to the package.json which pass the build but since two version has different parser naming, it wasn’t working properly.
Can someone explain further how to implement @n7best 's workaround? I’ve tried the below with no success.
@cgpomeroy Hi, have you found the way to solve it? Workaround from @n7best doesn’t work for me.
Was in a bit of a hurry, so I just downgraded to 2.12.1 which works absolutely fine and got me moving.
Will have a go at importing the file directly when I get a chance at the weekend and report back.
Thanks for the quick reply! 👍
I would try using the file in
dist/rss-parser.min.js. If you’re using version 2.x, you should also use the README from that version, as the API has changed. In particular, RSSParser is not a constructor in 2.x - instead, you useRSSParser.parseUrl(...)@cgpomeroy
I was able to implement in my create-react-app.
I’m using Axios to fetch the page data.