纸飞机的信笺
博客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

craCreateReactApp

配置说明BabelWebpackCSS 预处理器

添加 Webpack 路径别名#

配置如下:

const path = require('path')
 
/** @type {import('@craco/types').CracoConfig} */
module.exports = {
  webpack: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
}

添加 Webpack 外部依赖#

配置如下:

/** @type {import('@craco/types').CracoConfig} */
module.exports = {
  webpack: {
    externals: {
      jQuery: '$',
    },
  },
}

配置 Webpack 开发服务器#

配置如下:

/** @type {import('@craco/types').CracoConfig} */
module.exports = {
  devServer: {
    proxy: {
      '/api': {
        target: 'http://localhost:1234',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '',
        },
      },
    },
  },
}

添加 Webpack 插件#

配置如下:

/** @type {import('@craco/types').CracoConfig} */
module.exports = {
  webpack: {
    plugins: [
      // 在 CRA 的插件之前加载,默认的行为
      new Plugin(),
 
      // 在 CRA 的插件之后加载
      [new HtmlPlugin(), 'append'],
    ],
  },
}