草庐IT

Hexo-Next

全部标签

一起学习Next.js吧(下)

接上篇:一起学习Next.js吧(上)启用TypeScript创建tsconfig.json首先确保你已全局安装了TypeScript,若没有,先运行yarnaddglobaltypeScript;运行tsc--init后得到tsconfig.json;把jsconfig.json里的配置合并到tsconfig.json;删除jsconfig.json;tsconfig.json中添加"noImplicitAny":true,意为禁止隐式的any;在项目中安装typescript,yarnadd--devtypescript@types/node改后缀把文件名有.js改成.tsx;为什么识别不

在next.js中使用styled-component以及全局主题切换

文章目录​​使styled-component像SPA中使用​​​​step1安装插件​​​​step2根目录下创建`.babelrc`​​​​step3创建`page/_document.js`自定义Document​​​​参考特别感谢​​​​[应用主题]需完成上一步​​使styled-component像SPA中使用step1安装插件yarnaddbabel-plugin-styled-componentsstep2根目录下创建​​.babelrc​​{"presets":["next/babel"],//覆盖nextjs的默认babel配置,以本文件的babel配置为准"plugins"

在next.js中使用styled-component以及全局主题切换

文章目录​​使styled-component像SPA中使用​​​​step1安装插件​​​​step2根目录下创建`.babelrc`​​​​step3创建`page/_document.js`自定义Document​​​​参考特别感谢​​​​[应用主题]需完成上一步​​使styled-component像SPA中使用step1安装插件yarnaddbabel-plugin-styled-componentsstep2根目录下创建​​.babelrc​​{"presets":["next/babel"],//覆盖nextjs的默认babel配置,以本文件的babel配置为准"plugins"