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
npmpackage includes source maps in the/distfolder that point to original source files in a/srcdirectory. However, the/srcdirectory itself is not included in the published package, causingsource-map-loaderto fail with anENOENTerror.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.mjsto enable source map generation for all outputs and modifyingpackage.jsonto include the/srcdirectory in the published package.To reviewers
Here are the steps I used to verify changes:
yarn buildyarn packtar -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