brunolemos/react-native-web-monorepo

watchFolders don't resolve path of images from another package

hosseinmd opened this issue · 6 comments

I have an assets package for project images, after I Replace watchFolders with projectRoot, images not showing.

Does it work with watchFolders or projectRoot? You can leave it the way it works

It works with projectRoot. I think we should have a way to use watchFolders and still work images.

Have you tried setting both? Any particular reason to prefer watchFolders? I guess anything that works in your project should be fine

Have you tried setting both? Any particular reason to prefer watchFolders? I guess anything that works in your project should be fine

Your right, I will try both soon.

I just tried the code on master and it worked fine. Let me know if you managed it to work.

import image from 'assets/image.jpg'

<Image source={image} style={{ width: '100%', height: 400 }} />

I changed these tow files, everything work know

metro.config.js

module.exports = {
  projectRoot: path.resolve(__dirname, "../../"),
  watchFolders: [path.resolve(__dirname, "../../")],
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};

MainApplication.java

        @Override
        protected String getJSMainModuleName() {
          return "packages/mobile/index";
        }