I am suddenly facing this issue that seemingly came out of nowhere. The project I am working on in my company is rather large and we are using a micro frontend architecture. I was working in one branch yesterday and after building and pushing my code, I checked out to another branch to check something and then went back to the original branch I was in. After trying to serve the application again, I was faced with this error. It seems everyone else on the team is getting this error, too. Even those who haven't pulled the code I pushed.
Here is the error:
Error: ./node_modules/cheerio/node_modules/htmlparser2/lib/esm/index.js 59:9 Module parse failed: Unexpected token (59:9) File was processed with these loaders:
export * as DomUtils from "domutils"; | // Old name for DomHandler | export { DomHandler as DefaultHandler };
Error: ./node_modules/cheerio/node_modules/parse5/dist/index.js 6:9 Module parse failed: Unexpected token (6:9) File was processed with these loaders:
export * as foreignContent from './common/foreign-content.js'; | /** @internal */ | export * as html from './common/html.js';
I've tried:
Really not sure what else to do. This is my first stack overflow question so sorry if I'm missing any necessary info.
EDIT: I found two links on github
https://github.com/umijs/umi/issues/8109
https://github.com/cheeriojs/cheerio/issues/2545
and after following their instructions, I added cheerio to dev dependencies in package.json and then installed the 'stream' package. The error is resolved for the time being.