чем отличаются «babel-plugin-module-resolver» и «tsconfig-paths»? - PullRequest
0 голосов
/ 27 марта 2020

Я нахожу демо SSR (React + typcript + Next. js), и он использует эти два плагина.

Я был озадачен, почему его нужно оба из них ?

Насколько мне известно, эти два плагина сделали одинаковую работу , любой может объяснить, почему?

tsconfig. json

"paths": {
        "@components/*": [
            "./components/*"
        ],
        "@helper/*": [
            "./helper/*"
        ],
        "@utils/*": [
            "./utils/*"
        ],
        "@interfaces/*": [
            "./interfaces/*"
        ],
        "@api/*": [
            "./pages/api/*"
        ],
        "@serverApi/*": [
            "./server/api/*"
        ],
        "@newscenter/*": [
            "./newscenter/*"
        ],
        "@spotcenter/*": [
            "./spotcenter/*"
        ],
        "@styles/*": [
            "./styles/*"
        ]
    }

.babelr c

 "plugins": [
    [
        "module-resolver",
        {
            "root": ["./"],
            "alias": {
                "@components": "./components",
                "@helper": "./helper",
                "@utils": "./utils",
                "@interfaces": "./interfaces",
                "@api": "./pages/api",
                "@serverApi": "./server/api",
                "@newscenter": "./newscenter",
                "@spotcenter": "./spotcenter",
                "@styles": "./styles"
            }
        }
    ]
]

enter image description here

enter image description here

...