meteor / node-stubs

Stub implementations of Node built-in modules, a la Browserify
MIT License
17 stars 8 forks source link

[bug] Update to 0.3.3 causes error on the client. #14

Closed trusktr closed 6 years ago

trusktr commented 6 years ago

When upgrading from 0.3.2 to 0.3.3, an error begins to happen on the client side.

Check out the following repo at the following commit: https://github.com/trusktr/chat-widget/commit/09dff02f67cc1a5ba0ff12c3367b5aa4e688bbd4

If you npm install && meteor it will work just fine.

Then, if you open package.json and change the meteor-node-stubs version from ^0.3.2 to ^0.3.3 and run npm install (this updates package-lock.json), then restart the meteor app, you'll get an error like this in browser console:

Uncaught Error: Cannot find module 'meteor-node-stubs/node_modules/http-browserify/lib/response'
    at makeMissingError (modules-runtime.js?hash=d9c2212c27b8b694a403c725c46ea2897298b66e:241)
    at require (modules-runtime.js?hash=d9c2212c27b8b694a403c725c46ea2897298b66e:251)
    at dev-client.js (dev-client.js:1)
    at fileEvaluate (modules-runtime.js?hash=d9c2212c27b8b694a403c725c46ea2897298b66e:353)
    at require (modules-runtime.js?hash=d9c2212c27b8b694a403c725c46ea2897298b66e:248)
    at akryum_vue-component-dev-client.js?hash=c3b97fe72b9a08f45c5f4448c941098e1d937f84:11864
    at akryum_vue-component-dev-client.js?hash=c3b97fe72b9a08f45c5f4448c941098e1d937f84:11869
trusktr commented 6 years ago

Not sure if this has any impact on the application, as it seems to still run fine even though that error is in the console. Maybe I'm not using any features related to that package.

trusktr commented 6 years ago

Ah, I also see that the error relates to Akryum:vue

(cc @Akryum. Any ideas? Maybe I just need to update Akryum:vue-component (I'm on 0.13.0 and I see 0.13.1 is out. Will try it later... EDIT: same error with 0.13.1. Is vue-component dependending on an indirect depdency of meteor-node-stubs instead of the dependency itself?)

abernix commented 6 years ago

The problem stems from this line in akryum:vue-component, which broken due to this (necessary) change in meteor-node-stubs: https://github.com/meteor/node-stubs/commit/488059954d67e397432dea3b6dbe7696ee82939e.

The akryum:vue-component package will need to be updated. If it's used in client code (as it appears to be), I'd expect this could be fixed by import-ing from the http module, which we map to the desired implementation on behalf of client code:

import Response from 'http/lib/response';

...though alternatively, it would have to be changed to use stream-http instead of the unmaintained (And therefore no longer installed by meteor-node-stubs) http-browserify.