Giter VIP home page Giter VIP logo

Comments (5)

bruchim avatar bruchim commented on July 22, 2024

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.

ajzozakiewicz avatar ajzozakiewicz commented on July 22, 2024

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.

ajzozakiewicz avatar ajzozakiewicz commented on July 22, 2024

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.

bruchim avatar bruchim commented on July 22, 2024

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.

ajzozakiewicz avatar ajzozakiewicz commented on July 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.