Skip to content

Include src files in package to resolve source map warnings #5710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

John-Youngblood
Copy link

@John-Youngblood John-Youngblood commented Jun 24, 2025


name: Include src files in package
about: Include src files in package to resolve source map warnings
title: "Include src files in package to resolve source map warnings"
labels: "bug"
assignees: "martijnrusschen"

Description

Linked issue: #5416

Problem
The published npm package includes source maps in the /dist folder that point to original source files in a /src directory. However, the /src directory itself is not included in the published package, causing source-map-loader to fail with an ENOENT error.

Changes
This PR updates the build configuration to correctly generate and include source maps. This resolves the common "Failed to parse source map" warnings for developers using the library in modern bundlers. The main changes include updating rollup.config.mjs to enable source map generation for all outputs and modifying package.json to include the /src directory in the published package.

To reviewers

Here are the steps I used to verify changes:

  1. Checkout the changes and build the project as normal: yarn build
  2. Generate the published package: yarn pack
  3. Check for the now existing source files in the package: tar -tvf package.tgz | grep "src/"

This PR does increase the package size from ~375kb to ~499kb due to additional source files included in the package. These source files are used for development-time debugging only and are not included in the final production builds of applications that use react-datepicker, so there is no impact on end-user application size or performance.

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

Copy link

codecov bot commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.12%. Comparing base (e7e26d1) to head (bac655a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5710   +/-   ##
=======================================
  Coverage   97.12%   97.12%           
=======================================
  Files          30       30           
  Lines        3374     3374           
  Branches     1427     1424    -3     
=======================================
  Hits         3277     3277           
  Misses         95       95           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant