babel-plugin-module-resolver icon indicating copy to clipboard operation
babel-plugin-module-resolver copied to clipboard

help: using with submodules

Open zeitamin opened this issue 5 years ago • 1 comments

I have this git submodule named Shared in the parent project. I use absolute path in submodule like import A from 'src/components/...' that wouldn't work in parent project because src/components actually reside in shared/src/components/... as parent importing it. I wonder if there is anyway I could solve the problem using babel-plugin-module-resolver? this is how my tree look like:

-shared
  -src
    -components
      -other files...
-node_module
-src

so far I tried to create babel.config.js in the Shared folder with no luck

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      'module-resolver',
      {
        root: ['./src']
      }
    ]
  ]
};

zeitamin avatar Jan 21 '20 15:01 zeitamin

@zeitamin , did you ever find a solution? I'm working on this issue now.

mikestopcontinues avatar Mar 27 '20 19:03 mikestopcontinues