-
Notifications
You must be signed in to change notification settings - Fork 205
Open
Description
I'm trying to put together a monorepo project with react-native, typescript and get relative imports working and keep getting the following error:
Unable to resolve module `@screen/XXX` from `packages/project1/src/...`: @screen/XXX could not be found within the project
I noticed #276 sounds similar to what I'm experiencing, but I don't have any env related configuration and I can reproduce it even in the debug environment.
First, my mono repo structure is:
-root
--packages
----project1
------src
----project2
------src
...
I managed to get it all working on development environment, but have some weird behaviours happening:
- If I run
yarn workspace project1 run start//yarn workspace project1 run ioseverything works fine as mentioned, but running onlyrun yarn workspace project1 run iosfails to load the path giving the error above (likely because the packager is started from Xcode with a different working directory?) - If I run
./gradlew assemble... from the android folder, it also gives the same error above. - If I corrupt the
babel.config.jsfile (say add{!@#$: !@#, ...}) and run./gradlew assemblenothing seems to change
babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['./packages/project1/src/'],
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
alias: {
'@': './packages/project1/src',
'@screen': './packages/project1/src/screen',
'@util': './packages/project1/src/util/*',
'@nav': './packages/project1/src/navigation/*',
'@component': './packages/project1/src/component/*',
},
},
],
'babel-plugin-styled-components',
],
};
Resolver version: "babel-plugin-module-resolver": "^4.0.0",
Any ideas on what might have been happening or what am I missing?
tobiaseisenschenk, woowalker and bombillazo
Metadata
Metadata
Assignees
Labels
No labels