接上篇:一起学习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;为什么识别不
文章目录使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"
文章目录使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"