纸飞机的信笺
博客Awesome开源Demos制品库样板与配置

系统

command常用命令行
vscodeVSCode

通用

licenseLICENSE 许可
editorconfigEditorConfig
gitGit
typescriptTypeScript

Agent

claudeClaude Code
codexCodex

开发配置

nextjsNext.js
viteVite
vitestVitest
postcssPostCSS
rollupRollup
eslintESLint
prettierPrettier
tailwindcssTailwindCSS

包管理

npmnpm
nodejspackage.json

代码质量

huskyHusky
commitizenCommitizen
commitlintCommitLint
lintstagedLintStaged

传统

webpackWebpack
babelBabel
craCreateReactApp

杂项

monorepoMonorepo

nextjsNext.js

基础配置静态资源 CDN图片资源 CDNMarkdown 渲染

以下 next.config.ts 配置可在生产环境将所有静态资源的 URL 替换为 CDN。 注意这不包括上传流程,你需要自行通过其他工具进行上传。

配置如下:

const nextConfig: NextConfig = {
  assetPrefix: process.env.NODE_ENV === 'production' ? 'https://cdn.example.com' : undefined,
}

注意:Next.js 会针对图片来源进行限制,如果网站中存在使用 Image 组件且通过属性 src="https://..." 直接使用外部图片的情况,需要配置允许的图片来源:

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      { protocol: 'https', hostname: 'https://cdn.example.com' },
      // ...
    ],
  },
}

如果用到了外部 .svg 图片,还需要进一步配置:

const nextConfig: NextConfig = {
  images: {
    dangerouslyAllowSVG: true,
  },
}