Skip to content

EventEmitter rewrite issue #11

Description

@Jakub-Plan-d-k

Hello,
I am currently experiencing an issue with EventEmitter from Parse SDK. I had this issue already with webpack, which I have resolved with:
'react-native/Libraries/vendor/emitter/EventEmitter': path.resolve( __dirname, 'node_modules/react-native-web/dist/vendor/react-native/vendor/emitter/EventEmitter.js' ),
but it seems that with the reactNativeWeb plugin on, this does not work, because the plugin already rewrites it to react-native-web/Libraries/vendor/emitter/EventEmitter, which does not exist.
I have sort of made it work work with removing the plugin and just adding this in alias:
'react-native/Libraries/vendor/emitter/EventEmitter': path.resolve( __dirname, 'node_modules/react-native-web/dist/vendor/react-native/vendor/emitter/EventEmitter.js' ), 'react-native': path.resolve(__dirname, 'node_modules/react-native-web'),

Full error is:

[UNLOADABLE_DEPENDENCY] Error: Could not load react-native-web/Libraries/vendor/emitter/EventEmitter
   ╭─[ node_modules/parse/lib/react-native/EventEmitter.js:7:26 ]
   │
 7 │   EventEmitter = require('react-native/Libraries/vendor/emitter/EventEmitter');
   │                          ──────────────────────────┬─────────────────────────
   │                                                    ╰─────────────────────────── System nie może odnaleźć określonej ścieżki. (os error 3)
───╯

And comes from node_modules/parse/lib/react-native/EventEmitter.js:7:26

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var EventEmitter;
try {
  EventEmitter = require('react-native/Libraries/vendor/emitter/EventEmitter');
  if (EventEmitter.default) {
    EventEmitter = EventEmitter.default;
  }
  EventEmitter.prototype.on = EventEmitter.prototype.addListener;
} catch (_) {}
var _default = exports.default = EventEmitter;

I would still prefer to use your plugin. Is this something you can fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions