zhangyuang / ssr

A most advanced ssr framework support React17/React18/Vue2/Vue3 on Earth that implemented serverless-side render specification.
http://doc.ssr-fc.com/
MIT License
2.61k stars 284 forks source link

引入antd-mobile后不支持按需引入样式 #108

Closed wuyiifan closed 3 years ago

wuyiifan commented 3 years ago

提问前请确认以下几点信息,否则你的问题将不会被解答

详细描述你的问题

使用antd-mobile后不支持引入样式,配置babelExtraModule: [/module-name/]也不生效

期望的结果

能按需antd-mobile的样式

当前使用的版本

    "@ant-design/icons": "^4.6.3",
    "@midwayjs/cache": "^2.12.7",
    "@midwayjs/decorator": "^2.12.3",
    "@midwayjs/swagger": "^1.0.7",
    "@midwayjs/web": "^2.12.7",
    "antd": "^4.16.12",
    "antd-mobile": "^2.3.4",
    "axios": "^0.21.1",
    "cache-manager": "^3.4.4",
    "egg": "^2.30.0",
    "egg-mysql": "^3.0.0",
    "egg-scripts": "^2.14.0",
    "mysql": "^2.18.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.2.0",
    "ssr-core-react": "^5.6.5",
    "ssr-types-react": "^5.6.4",

复现仓库地址

你本人对问题可能的原因判断(如果你能大概判断的话)

zhangyuang commented 3 years ago

根目录创建 babel.config.js,并写入如下内容


module.exports = { 
    "plugins": [ 
        ["import", { 
            "libraryName": "antd-mobile", 
             "libraryDirectory": 'lib',
            "style": true 
        }, 'antd-mobile'] 
    ] 
} 
wuyiifan commented 3 years ago

根目录创建 babel.config.js,并写入如下内容

module.exports = { 
    "plugins": [ 
        ["import", { 
            "libraryName": "antd-mobile", 
             "libraryDirectory": 'lib',
            "style": true 
        }, 'antd-mobile'] 
    ] 
} 

非常感谢