Include src files in package to resolve source map warnings #5710
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, causingsource-map-loader
to fail with anENOENT
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 modifyingpackage.json
to include the/src
directory in the published package.To reviewers
Here are the steps I used to verify changes:
yarn build
yarn pack
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