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

React with Web Worker Error #2839

Open
5 tasks done
gokalpfirat opened this issue Aug 8, 2024 · 2 comments
Open
5 tasks done

React with Web Worker Error #2839

gokalpfirat opened this issue Aug 8, 2024 · 2 comments

Comments

@gokalpfirat
Copy link

gokalpfirat commented Aug 8, 2024

Describe the bug

With NextJS 14 importing web worker is causing an error and won't load it. At version 8.3.13 it works, before @module-federation runtime refactored. I manage to create a basic reproduction for you. Be careful dont use dev server. Build it and start.

image
image

Code from remote/index.ts can't use isBrowserEnv function after 8.3.14 version after runtime core is refactored to runtime/index.ts.

Code is crashing at line

if (isBrowserEnv() && !remote.entry.startsWith('http')) {

Possible fix: isBrowserEnv function can be used from util folder https://github.com/module-federation/core/blob/main/packages/runtime/src/utils/env.ts without having to be imported from sdk

image
image
image

Reproduction

https://github.com/gokalpfirat/nextjs-mf-example-v2

Not dev server, npm run build && npm run start

Used Package Manager

npm

System Info

System:
    OS: macOS 14.2.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 185.97 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 9.5.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 127.0.6533.100
    Safari: 17.2.1

Validations

@gokalpfirat
Copy link
Author

@ScriptedAlchemy

@gokalpfirat
Copy link
Author

Any updates for this issue? @ScriptedAlchemy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant