From a37701dade87bbba43dabc71414db855ca15505d Mon Sep 17 00:00:00 2001 From: Martijn Russchen Date: Fri, 5 Dec 2025 13:59:45 +0100 Subject: [PATCH] fix: Inline source content in source maps to prevent Webpack warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Source maps now embed the original TypeScript source content directly, preventing Webpack's source-map-loader from throwing warnings about missing source files when consuming the package. Fixes #5549 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- rollup.config.mjs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 61933821a6..7119ce6d6a 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -38,10 +38,18 @@ const migrateRollup2to3OutputOptions = { interop: "compat", }; +// Common sourcemap options to embed source content directly in the map +// This prevents Webpack source-map-loader warnings about missing source files +// See: https://github.com/Hacker0x01/react-datepicker/issues/5549 +/** @type {Partial} */ +const sourcemapOptions = { + sourcemap: true, + sourcemapExcludeSources: false, +}; + /** @type {import('rollup').RollupOptions} */ const config = { input: "src/index.tsx", - sourcemap: true, output: [ { file: pkg.unpkg, @@ -50,32 +58,32 @@ const config = { globals, banner, ...migrateRollup2to3OutputOptions, + ...sourcemapOptions, plugins: [terser()], - sourcemap: true, }, { file: pkg.unpkg.replace(".min.js", ".js"), format: "umd", - sourcemap: true, name: "DatePicker", globals, banner, ...migrateRollup2to3OutputOptions, + ...sourcemapOptions, }, { file: pkg.main, format: "cjs", - sourcemap: true, name: "DatePicker", banner, ...migrateRollup2to3OutputOptions, + ...sourcemapOptions, }, { file: pkg.module, format: "es", - sourcemap: true, banner, ...migrateRollup2to3OutputOptions, + ...sourcemapOptions, }, ], plugins: [ @@ -89,6 +97,8 @@ const config = { tsconfig: "./tsconfig.build.json", declaration: true, declarationDir: "dist", + sourceMap: true, + inlineSources: true, }), filesize(), ],