Skip to content

Conversation

@martijnrusschen
Copy link
Member

Summary

  • Uses __non_webpack_require__ to load the optional date-fns-tz module
  • This tells webpack to use the native Node.js require at runtime instead of trying to bundle/analyze the module
  • Eliminates the "Critical dependency: the request of a dependency is an expression" warning

Background

When date-fns-tz is not installed (it's an optional peer dependency), webpack emits a warning because it can't statically analyze the dynamic require(variable) pattern. By using webpack's special __non_webpack_require__ global, we bypass webpack's bundling analysis while still falling back to regular require in non-webpack environments.

Test plan

  • TypeScript type checking passes
  • All 1479 tests pass
  • Build succeeds and includes the fix in dist output

Fixes #6181

🤖 Generated with Claude Code

Use __non_webpack_require__ to load the optional date-fns-tz module.
This tells webpack to use the native Node.js require at runtime instead
of trying to bundle/analyze the module, eliminating the "Critical
dependency: the request of a dependency is an expression" warning.

Fixes #6181

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.31%. Comparing base (644f2f5) to head (b06237b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6182   +/-   ##
=======================================
  Coverage   99.31%   99.31%           
=======================================
  Files          30       30           
  Lines        3810     3812    +2     
  Branches     1639     1642    +3     
=======================================
+ Hits         3784     3786    +2     
  Misses         25       25           
  Partials        1        1           

☔ 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.

Adds a test that simulates a webpack environment by defining
__non_webpack_require__ globally, ensuring the branch that uses
webpack's native require bypass is covered.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

v.9.1.0 webpack warning (p2)

2 participants