react.js 762 B

123456789101112131415161718192021222324252627282930313233
  1. const { pluginReact } = require('@rsbuild/plugin-react');
  2. const createEslintPlugin = require('./plugins/eslint');
  3. const baseConfig = require('./base');
  4. const { mergeRsbuildConfig } = require('@rsbuild/core');
  5. /**
  6. * React 应用的 Rsbuild 配置
  7. */
  8. const reactConfig = {
  9. plugins: [
  10. pluginReact({
  11. // React 插件配置
  12. fastRefresh: true,
  13. }),
  14. createEslintPlugin(),
  15. ],
  16. source: {
  17. // 默认入口配置
  18. entry: {
  19. index: './src/index',
  20. },
  21. // 默认支持的文件扩展名
  22. extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
  23. },
  24. dev: {
  25. // 开发服务器配置
  26. port: 3000,
  27. open: true,
  28. },
  29. };
  30. // 合并基础配置和 React 配置
  31. module.exports = mergeRsbuildConfig(baseConfig, reactConfig);