美文网首页
create-react-app --typescript 配置

create-react-app --typescript 配置

作者: Issho | 来源:发表于2020-03-19 14:59 被阅读0次

1、执行以下命令

git init
git add .
git commit -m 'xxx'
npm run eject

2、在【config】文件夹下的【webpack.config.js】中找到【alias】属性,添加以下代码

alias: {
    '@': paths.appSrc
}

3、在根目录下的【tsconfig.json】中,添加以下代码

{
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"]
    },
}

相关文章

网友评论

      本文标题:create-react-app --typescript 配置

      本文链接:https://www.haomeiwen.com/subject/gsstactx.html