babel-plugin-module-resolver isn't working in my code

156 Views Asked by At

babel-plugin-module-resolver isn't working in my code, i tried a lot of things but anything is working, i want learn more about this. ..............................................................................................................................................................................................................................................................................................................................................................................................................................................

Babel.config.js

module.exports = function (api) {
    api.cache(true);
    return {
        presets: ["babel-preset-expo"],
        plugins: [
            "module-resolver",
            {
                root: ["./src"],
                extensions: [".js", ".jsx", ".ts", ".tsx"],
                alias: {
                    "@assets": "./src/assets",
                    "@components": "./src/components",
                    "@config": "./src/config",
                    "@hooks": "./src/hooks",
                    "@routes": "./src/routes",
                    "@screens": "./src/screens",
                    "@services": "./src/services",
                    "@styles": "./src/styles",
                    "@utils": "./src/utils",
                },
            },
        ],
    };
};

tsconfig.json

{
    "extends": "expo/tsconfig.base",
    "compilerOptions": {
        "jsx": "react",
        "strict": true,
        "baseUrl": "./",
        "paths": {
            "@src/*": [
                "./src/*"
            ],
            "@assets/*": [
                "./assets/*"
            ],
            "@components/*": [
                "./components/*"
            ],
            "@config/*": [
                "./config/*"
            ],
            "@hooks/*": [
                "./hooks/*"
            ],
            "@routes/*": [
                "./routes/*"
            ],
            "@screens/*": [
                "./screens/*"
            ],
            "@services/*": [
                "./services/*"
            ],
            "@styles/*": [
                "./styles/*"
            ],
            "@utils/*": [
                "./utils/*"
            ]
        }
    },
    "include": [
        "**/*.ts",
        "**/*.tsx",
        ".expo/types/**/*.ts",
        "expo-env.d.ts"
    ]
}

i'm expecting this import work

import Test from "@rook";

(OBS: Test is an arquiveFile.tsx in a folder called Test)

0

There are 0 best solutions below