[NextJS] Compilation fails during build
hali241997 opened this issue · 4 comments
I am using the html-react-parser
and htmlparser2
is a dependency of it. I had already opened the issue there but was asked to open the issue here.
Expected Behavior
After running next build
command, the build should compile without any errors
Actual Behavior
Failed to compile when I run next build
but it works in development
This is the error:
../../node_modules/htmlparser2/lib/index.d.ts:2:23
Type error: ',' expected.
1 | import { Parser, ParserOptions } from "./Parser.js";
> 2 | export { Parser, type ParserOptions };
| ^
3 | import { DomHandler, DomHandlerOptions, ChildNode, Element, Document } from "domhandler";
4 | export { DomHandler, type DomHandlerOptions };
5 | declare type Options = ParserOptions & DomHandlerOptions;
Steps to Reproduce
- Install html-react-parser@^3.0.4.
- Use the parser config option.
- Run
next build
Reproducible Example:
https://codesandbox.io/s/html-react-parser-issue-v3rnw4
It's not loading up correctly due to some issue with babel. But if you run yarn build
, you will get the same issue that I am experiencing.
Environment
Platform: NextJS
Browser: Chrome
The minimum supported TypeScript version was bumped with the last major release. Please try using a current release.
Thank you
✖ ... /.pnpm/htmlparser2@8.0.1/node_modules/htmlparser2/lib/index.d.ts:32:37 - error TS1005: ',' expected.
32 export { default as Tokenizer, type Callbacks as TokenizerCallbacks, } from "./Tokenizer.js";
~~~~~~~~~
I still see the same Tried initially with 1.* and now 3.* and typescript latest 4.8.4
Little urgent if you need more info let me know.
using bit.cloud
Always feel free to downgrade to htmlparser2@7 if you are unable to control your TS version. No need to be on bleeding edge.