Paciolan / remote-module-loader

Loads a CommonJS module from a remote URL for the Browser or Node.js.
MIT License
85 stars 20 forks source link

Can't resolve 'http'? #34

Open spyhunter99 opened 10 months ago

spyhunter99 commented 10 months ago

First of all, awesome library. i hope i can get it working.... I'm talking through the tutorial from https://github.com/Paciolan/remote-component, refresh react projects. I was able to get a react component to compile but was unable to get it to load in the main app. I then tried to load the tutorial's plugin via github. (kind of new to react/nodejs stuff so bare with me)...

Anyhow, this is the error i'm getting.

Module not found: Error: Can't resolve 'http' in 'myapp\node_modules\@paciolan\remote-module-loader\dist\lib'
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: { "http": require.resolve("stream-http") }'
        - install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "http": false }

i did try npm i stream-http http https but that didn't fix anything. Trying to understand the error message...is this a webpack versioning issue?

leejunhui commented 9 months ago

I also encountered this issue, @spyhunter99 did you figure out a workaround?

see2ever commented 9 months ago

webpack.config.js

resolve: {
      fallback: {
        http: false,
        https: false,
      },
    },
huy-lv commented 4 months ago

how to fix this without webpack.config.js