Comments (5)
Hey @ajzozakiewicz,
The resolving is done by the name of the module in the "name" section in your package.json
and the "main" section which should point to the module.js
file.
"main": "./src/module.js",
"name": "wix-engine-playground-module-blog",
I hope it answers your question.
from react-native-wix-engine-playground.
Sure, when wix-engine-playground-module-blog
is installed as an NPM module it will resolved that way. Will the metro bundler know to resolve it though for local dev? When I say local dev, I am in the module-blog
repo, running rn-wix-engine -p engineConfig.json -i
. engineConfig.json
contains a ref to "wix-engine-playground-module-blog"
.
When running within module-blog
how does the metro bundler know to resolve this to the local folder rather than "wix-engine-playground-module-blog" from node_modules?
So I am looking at this config:
https://github.com/wix-incubator/react-native-wix-engine-playground/blob/main/module-blog/engineConfig.json
And running npm run ios
here:
https://github.com/wix-incubator/react-native-wix-engine-playground/blob/main/module-blog/package.json
Hope this clarifies my question. Kind of hard to explain. Appreciate the help.
from react-native-wix-engine-playground.
Using a babel transform I am sure you could resolve any refs to the local project folder, but I didnt see any special transforms for this to work.
from react-native-wix-engine-playground.
One of the search paths of metro is the current module, so wix-engine-playground-module-blog
not have to be in your node_module
folder but in one of the following:
myProject/
myProject/node_modules/
myProject/node_modules/@scope/
/usr/local/lib/node_modules/
/usr/local/lib/node_modules/@scope
/usr/local/lib/node_modules/npm/node_modules/
/usr/local/lib/node_modules/npm/node_modules/@scope
$HOME/.npm/
$HOME/.npm/@scope/
If you interested you can dig into metro ModuleResolution logic here:
https://github.com/facebook/metro/blob/master/packages/metro/src/node-haste/DependencyGraph/ModuleResolution.js
from react-native-wix-engine-playground.
Awesome, that makes perfect sense now. Guess I need to get in a better habit of reading source code...
Thanks for pointing me in the right direction on this one.
from react-native-wix-engine-playground.
Related Issues (6)
- "yarn ios" Error: Element type is invalid: expected a string. Check the render method of `SettingsScreen`. HOT 2
- Why does module-blog contain native deps in package.json? HOT 3
- Breaking changes that occur with engine modules
- Migrate to RN 0.66.4, react-native-navigation build error "ld: library not found for -lCocoaAsyncSocket"
- Anyone figured out the publish app steps in the guide?
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 react-native-wix-engine-playground.