Reputation: 1
I'm encountering a build error in my React application when running npm run build. The development server works fine with npm start, but the build fails with the following error:
./node_modules/pdfjs-dist/build/pdf.js 1841:51
Module parse failed: Unexpected token (1841:51)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| intent: renderingIntent,
| renderInteractiveForms: renderInteractiveForms === true,
annotationStorage: annotationStorage?.serializable || null
| });
| }
Environment:
Node.js Version: 12.16.1
npm Version: 6.13.4
React Version: 16.12.0
pdfjs-dist Version: 2.8.335
Webpack Version: 4.41.0
babel-loader: 8.0.6
What could be causing this parse error related to the optional chaining syntax during the build process, and how can I resolve it?
Downgraded pdfjs-dist to version 2.6.347, but had no luck as it threw a different error related to babel-loader.
Upvotes: 0
Views: 114