Moiz Shahid
Moiz Shahid

Reputation: 11

why is this giving a syntax error ? resolve.fallback: { "http": require.resolve("stream-http") }

I am using a pdf-parse library. When i execute my code it gave the following error

Module not found: Error: Can't resolve 'url' in 'D:\FYP material\website tutorial\newone\fem-2\node_modules\pdf-parse\lib\pdf.js\v1.10.100\build'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
        - install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "url": false }

webpack compiled with 9 errors

After some research i found to include resolve.fallback: { "http": require.resolve("stream-http") } in my web.config.js which is located in nodemodules/reactscripts/config/web.config.js but when i put this in my web.config.js it gave a sytax error "; expected". Please help or devise an alternative solution

I tried resolve.fallback: { "http": require.resolve("stream-http") }
and resolve: { fallback: { "http": require.resolve("stream-http") } } in my module.exports in web.config.js but gave a syntax error

Upvotes: 1

Views: 134

Answers (0)

Related Questions