Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No export default #103

Open
1 of 13 tasks
templar820 opened this issue Jun 6, 2024 · 3 comments
Open
1 of 13 tasks

No export default #103

templar820 opened this issue Jun 6, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@templar820
Copy link

Description

In 2.2.0 all working correctly

Steps to reproduce

import {EventBus} from "@trutoo/event-bus";

const eventBus = new EventBus();

function App() {

  useEffect(() => {
    eventBus.register('namespace:eventName', { type: 'string' });
    const sub = eventBus.subscribe<boolean>('namespace:eventName', ({payload}) => {
      console.log(payload);
    });
    return () => {
      sub.unsubscribe();
    }
  },[])

Error EventBus is not exported. In 2.2.0 all working correctly

Library Version

2.3.0

Browser

  • Chrome
  • Edge*
  • Safari
  • Firefox
  • Opera
  • IE
  • Other

Platform

  • Windows
  • MacOS
  • Linux
  • Android
  • iOS
  • Other

Additional Information

No response

@Swiftwork Swiftwork self-assigned this Jun 8, 2024
@Swiftwork Swiftwork added the bug Something isn't working label Jun 8, 2024
@Swiftwork
Copy link
Contributor

Odd, I'll take a look.

@Swiftwork
Copy link
Contributor

@templar820 Thanks for bringing this to our attention. When we upgraded the dependencies rollup CommonJS changed how they handled exports. It no longer includes esModule boolean:

Object.defineProperty(exports, '__esModule', { value: true });

So it is likely that your build system isn't happy with this change. To help us reproduce and resolve this issue could you please provide us with the following information:

  1. Which build tool and version are you using (webpack 5, rollup 4, vite 5, etc...)?
  2. Are you using the named export import { EventBus } from "@trutoo/event-bus"; or are you attempting to use commonjs default require const EventBus = require('@trutoo/event-bus');

We attempted to reproduce your error in a sandbox, but saw no errors https://codesandbox.io/p/sandbox/event-bus-test-92spz4. Try implementing something similar and see if that works.

Until we can resolve your issue feel free to keep using 2.2.0 as very little has changed between the versions other than the build process.

@templar820
Copy link
Author

Just cra. It's webpack 5. m1 Mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants