Verify package.json accuracy

Ensure that package.json configuration entries accurately reflect the actual project structure and include complete, working settings. Incorrect or incomplete package.json configuration can cause runtime failures and deployment issues.

copy reviewer prompt

Prompt

Reviewer Prompt

Ensure that package.json configuration entries accurately reflect the actual project structure and include complete, working settings. Incorrect or incomplete package.json configuration can cause runtime failures and deployment issues.

Key practices:

  • Verify that the main field points to the correct entry file path
  • Include complete configuration objects rather than shortcuts (e.g., full Babel preset configurations with targets)
  • Test package configuration in a clean environment before publishing
  • Maintain consistent formatting throughout configuration files

Example of problematic vs. correct configuration:

// Problematic - main points to wrong file
{
  "main": "index.js",  // but actual file is dist/index.js
  "babel": {
    "presets": ["@babel/preset-react"]  // incomplete, missing targets
  }
}

// Correct - accurate paths and complete configuration
{
  "main": "dist/index.js",
  "babel": {
    "presets": [
      "@babel/preset-react",
      [
        "@babel/preset-env",
        {
          "targets": {
            "node": "current"
          }
        }
      ]
    ]
  }
}

Always validate that configuration entries work as intended in the target environment before committing or publishing.

Source discussions