美文网首页
Taro scss module 方案

Taro scss module 方案

作者: 吴占超 | 来源:发表于2022-10-18 11:40 被阅读0次

    采用react-hooks方案,使用scss方案为解决classname冲突,采用module方案。

    $ yarn add typescript-plugin-css-modules -D 
    

    根目录创建[.vscode]文件夹
    创建文件[.vscode/settings.json]

    {
      "typescript.tsdk": "node_modules/typescript/lib",
      "typescript.enablePromptUseWorkspaceTsdk": true,
    }
    

    根目录创建[tsconfig.json]

    {
      "compilerOptions": {
        // The usual
        "plugins": [
          {
            "name": "typescript-plugin-css-modules"
          }
        ],
      },
      "references": [
        {
          "path": "cloud"
        },
        {
          "path": "api-type"
        },
        {
          "path": "client"
        }
      ]
    }
    

    client独立目录则也需要增加插件 以及 tsconfig

    相关文章

      网友评论

          本文标题:Taro scss module 方案

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