Comments (4)
but i dont understand why it doesn't work when unstable_enablePackageExports is enabled. i guess if problem is ws as you said, It should have been equally bad when this option is disabled, but it works.
It's probably upstream of ws
- my guess is that you have a dependency which only requires ws
when running under Node.js, and it's the entry point to that dependency that's being resolved differently with unstable_enablePackageExports
. You'd need to find out what's requiring ws
- pnpm why ws
might have some clues.
from metro.
Hi @boh001. ws
is a WebSocket implementation for Node.js, and not compatible (or necessary) for the browser or React Native (which has a native WebSocket
global).
If you're not importing ws
directly it might be a dependency of one of your dependencies.
If you have a require stack, we can see why it's being imported. It may be that an intermediate dependency is resolving to a Node.js version.
from metro.
@robhogan thank you for reply. I think that's all there is to the require stack
error: Error: Unable to resolve module stream from /Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/ws/lib/stream.js: stream could not be found within the project or in these directories:
../../../node_modules/.pnpm/[email protected]/node_modules
../../../node_modules
1 | 'use strict';
2 |
> 3 | const { Duplex } = require('stream');
| ^
4 |
5 | /**
6 | * Emits the `'close'` event on a stream.
at ModuleResolver.resolveDependency (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:153:15)
at DependencyGraph.resolveDependency (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/node-haste/DependencyGraph.js:279:43)
at /Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/lib/transformHelpers.js:176:21
at resolveDependencies (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:56:25)
at visit (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:107:30)
at async Promise.all (index 1)
at async visit (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
at async Promise.all (index 8)
at async visit (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
at async Promise.all (index 0)
but i dont understand why it doesn't work when unstable_enablePackageExports is enabled. i guess if problem is ws as you said, It should have been equally bad when this option is disabled, but it works.
thank you :)
from metro.
pnpm why ws
shows nothing. it's so weird.
for now, it looks like the only way is to disable this option. is it okay to leave the issue open for people have the same problem? Maybe someone will solve it one day :)
from metro.
Related Issues (20)
- The Metro bundler does not connect to iOS devices HOT 1
- zip
- Is metro will support pnpm in the future? HOT 2
- Could not determine the dependencies of task ' :react-native-gesture-handler:generateDebugRFile' HOT 2
- [0.73.x] Metro crashes because of `__loadBundleAsync` HOT 6
- [0.80.4] Metro bundle duplicated code when use unstable_enablePackageExports and unstable_enableSymlinks HOT 3
- No matching version found for [email protected] HOT 1
- Unable to resolve module when using symlinks. HOT 6
- error Cannot read properties of undefined (reading 'transformFile'). TypeError: Cannot read properties of undefined (reading 'transformFile') HOT 2
- Metro uses watchman that leaks watched files HOT 2
- Default metro resolver slower than MetroSymlinksResolver in a monorepo HOT 3
- React Native application does not update on many code changes when using vim HOT 4
- esm HOT 1
- Performance regression between 0.73.9 and 0.76.8 HOT 4
- Unable to resolve self-referring "subpath exports" from within a haste module HOT 1
- `nodeModulesPaths` not working as expected with React Native HOT 1
- Cannot read property 'transformFile' of undefined HOT 1
- Including local packages from outside project root. Can we do better?
- [BUG] Terser mangler issue after upgrading to RN 0.74.5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metro.