Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ';巴别塔插件模块解析器';和';t配置路径';?_Javascript_Reactjs_Typescript_Babeljs_Next.js - Fatal编程技术网

Javascript ';巴别塔插件模块解析器';和';t配置路径';?

Javascript ';巴别塔插件模块解析器';和';t配置路径';?,javascript,reactjs,typescript,babeljs,next.js,Javascript,Reactjs,Typescript,Babeljs,Next.js,我发现了一个SSR演示(React+typescript+Next.js),它使用了这两个插件 我很困惑,为什么它需要他们两个 就我而言,这两个插件做了相同的工作,任何人都可以解释为什么 tsconfig.json B.法律改革委员会 这是一个老问题。但对于将来遇到这种情况的人,我想我会更新 jsconfig.json(或者tsconfig.json,如果您使用的是typescript)是通知您的IDE您正在使用这些别名。例如,vscode或intellij将知道在哪里检查导入是否正常工作 b

我发现了一个SSR演示(React+typescript+Next.js),它使用了这两个插件

我很困惑,为什么它需要他们两个

就我而言,这两个插件做了相同的工作,任何人都可以解释为什么

tsconfig.json

B.法律改革委员会


这是一个老问题。但对于将来遇到这种情况的人,我想我会更新

jsconfig.json(或者tsconfig.json,如果您使用的是typescript)是通知您的IDE您正在使用这些别名。例如,vscode或intellij将知道在哪里检查导入是否正常工作


babel的模块解析器插件告诉服务器从这些别名导入文件

两者的最终结果相同,但其中一个用于Typescript,另一个用于Javascript
"paths": {
        "@components/*": [
            "./components/*"
        ],
        "@helper/*": [
            "./helper/*"
        ],
        "@utils/*": [
            "./utils/*"
        ],
        "@interfaces/*": [
            "./interfaces/*"
        ],
        "@api/*": [
            "./pages/api/*"
        ],
        "@serverApi/*": [
            "./server/api/*"
        ],
        "@newscenter/*": [
            "./newscenter/*"
        ],
        "@spotcenter/*": [
            "./spotcenter/*"
        ],
        "@styles/*": [
            "./styles/*"
        ]
    }
 "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"
            }
        }
    ]
]