babel-loader You may need an additional loader to handle the result of these loaders.
See original GitHub issueGetting this error while running in a typescript project, but works fine a react js project.
./node_modules/pdfjs-dist/build/pdf.js 3657:145
Module parse failed: Unexpected token (3657:145)
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.
| numPages: this._numPages,
| annotationStorage: (annotationStorage === null || annotationStorage === void 0 ? void 0 : annotationStorage.getAll()) || null,
> filename: ((_this$_fullReader = this._fullReader) === null || _this$_fullReader === void 0 ? void 0 : _this$_fullReader.filename) ?? null
| }).finally(() => {
| if (annotationStorage) {
tsconfig.json
{
"compilerOptions": {
"target": "ES5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
package.json
{
"name": "react-form",
"version": "0.1.0",
"private": true,
"dependencies": {
"@hookform/resolvers": "^1.3.5",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.33",
"@types/pdf-viewer-reactjs": "2.2.1",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2",
"axios": "^0.21.1",
"axios-cache-adapter": "^2.7.3",
"bulma": "^0.9.2",
"bulma-helpers": "^0.4.0",
"loadash": "^1.0.0",
"localforage": "^1.9.0",
"material-icons": "^0.5.4",
"node-sass": "^5.0.0",
"notistack": "^1.0.7",
"pdf-viewer-reactjs": "^2.2.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-dropzone": "^11.3.2",
"react-helmet-async": "^1.0.9",
"react-hook-form": "6.15.7",
"react-number-format": "^4.5.5",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"typescript": "^4.2.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
"@types/react-helmet": "^6.1.1",
"@types/react-html-parser": "^2.0.1",
"@types/react-redux": "^7.1.16",
"@types/react-router-dom": "^5.1.7",
"@types/redux-logger": "^3.0.8",
"babel-loader": "8.1.0",
"material-ui": "^0.20.2",
"react-helmet": "^6.1.0",
"react-html-parser": "^2.0.2",
"react-redux": "^7.2.3",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"zod": "^1.11.11"
}
}
kindly resolve this. Let me know if any additional input is required.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:10
Top Results From Across the Web
"You may need an additional loader to handle the result of ...
I solved my problem by these procedures. In terminal: rm -rf node_modules && rm -f package-lock.json npm cache clean --force. I ...
Read more >You May need additional loader to handle the result of these ...
js in the project's root according to instructions for react-app-rewire-babel-loader: /* config-overrides.js */ const path = require("path ...
Read more >babel-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >"You may need an additional loader to handle the result of ...
I 'd like to import Mercury module, but some errors occur. I can't confirm this reason on react version or other things.
Read more >You may need an appropriate loader to handle this file type ...
I 'm having a problem configuring Webpack for Typescript and React. After running the NPM script: webpack serves ./webpack/webpack.config.ts ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The below solution works for me First, install
npm install npm-force-resolutions --save-dev
Then in
package.json
we need to override the pdfjs-dist version to previous working version like thisand in
scripts
section add new preinstall entry:now if you do npm install and run your application it should work. Hope it helps
The root cause of the problem is , though in the dependency package.json has version
2.6.347
forpdfjs-dist
since^
was there before the version number during npm install, it installs the most recent version ofpdfjs-dist
which is causing this problem.Hey ! Did u get any solution for this ? I am facing the same issue . Please do inform if u got any solution it would be helpful