草庐IT

React 大屏脚手架

1.使用create-react-app初始化#使用了create-react-app的typescript模板yarncreatereact-appmy-big-screen--templatetypescript#初始化之后进入my-big-screen文件目录下执行yarnstart#localhost:3000就能看到react的hello页面了2.引入antdUI库#在根目录下yarnaddantd3.使用craco插件来自定义配置安装cracoyarnadd@craco/craco修改package.json文件如下#原本"scripts":{"start":"react-scri

react使用craco.config.js完成rem移动端适配(sass)

环境:  "react":"^18.2.0",  "react-dom":"^18.2.0",  "react-router-dom":"^6.8.2",     "sass":"^1.58.3",yarnadd@craco/cracopostcss-pxtoremlib-flexible1、创建craco.config.js2、将下方代码复制到craco.config.js中module.exports={style:{postcss:{mode:'extends',loaderOptions:{postcssOptions:{ident:'postcss',plugins:[['postc

react使用craco.config.js完成rem移动端适配(sass)

环境:  "react":"^18.2.0",  "react-dom":"^18.2.0",  "react-router-dom":"^6.8.2",     "sass":"^1.58.3",yarnadd@craco/cracopostcss-pxtoremlib-flexible1、创建craco.config.js2、将下方代码复制到craco.config.js中module.exports={style:{postcss:{mode:'extends',loaderOptions:{postcssOptions:{ident:'postcss',plugins:[['postc

记录create-react-app使用craco-fast-refresh热更新插件,报错Uncaught TypeError: Cannot read properties of undefined (reading 'signature')

1.问题背景项目在引用自研组件库后,启动后webpack报错热更新存在问题,无法正常启动2.解决方案在询问组件库开发同事,被告知无问题;百度无果;查找webpack源码后,发现能定位到报错的代码位置,却无力解决时。我决定使用控制变量法,禁用热更新插件,来解决问题。幸运的是,还真就解决了,注释掉热更新组件后,组件能正常引入了。3.结尾目前此问题还不知道原因,只能去找找其他热更新插件是否可用了。

记录create-react-app使用craco-fast-refresh热更新插件,报错Uncaught TypeError: Cannot read properties of undefined (reading 'signature')

1.问题背景项目在引用自研组件库后,启动后webpack报错热更新存在问题,无法正常启动2.解决方案在询问组件库开发同事,被告知无问题;百度无果;查找webpack源码后,发现能定位到报错的代码位置,却无力解决时。我决定使用控制变量法,禁用热更新插件,来解决问题。幸运的是,还真就解决了,注释掉热更新组件后,组件能正常引入了。3.结尾目前此问题还不知道原因,只能去找找其他热更新插件是否可用了。