Skip to content
This repository was archived by the owner on Sep 4, 2026. It is now read-only.

docs: deprecate the loader - #277

Merged
alexander-akait merged 2 commits into
mainfrom
claude/expose-loader-deprecation-y2rp9w
Sep 4, 2026
Merged

docs: deprecate the loader#277
alexander-akait merged 2 commits into
mainfrom
claude/expose-loader-deprecation-y2rp9w

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

Marks the loader deprecated in the README and gives the migration in two forms: the one line where the file is yours (import { jQuery as $ } from "jquery"; globalThis.$ = $;), and the processResult plugin where it is not, linking to webpack's expose-global example (webpack/webpack#21952) as a working copy of it.

Neither form wraps the module in a second one, which is what the loader has to do — and what #25, #227 and #256 are about, so the README says which of them each form settles. It also notes the two things that decide whether the assignment runs: something has to import the module, and a file in a "sideEffects": false package needs { test: /…/, sideEffects: true }.

Documentation only — src/ is untouched, so the loader keeps working exactly as it does today.

Refs #25, refs #227, refs #256

What kind of change does this PR introduce?

docs

Did you add tests for your changes?

No — README only, no source change. npm test (68 tests) and npm run lint pass unchanged.

Does this PR introduce a breaking change?

No. The loader is unchanged; the deprecation is a notice, not a behavior change. npm deprecate and archiving remain separate decisions.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

webpack.js.org's expose-loader page can carry the same notice and point at the example.

Use of AI

Written with Claude Code, reviewed and directed by me: the migration guide and the snippet were produced in that session, the snippet mirrors the merged example, and the claims about what the loader's wrapper module costs were checked against real builds before being written down.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XWZM9YmKFi3ZeziHv69S4Q


Generated by Claude Code

Assigning a module to the global object needs no loader: it is one line
where the file is yours, and an appended line through `NormalModule`'s
`processResult` hook where it is not. The README now says so, and points
at webpack's expose-global example for the second form.
The example keeps the plugin in the configuration rather than in a file
of its own, so the snippet shows the class where the example puts it.
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.99%. Comparing base (5be92d7) to head (8130f2c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #277   +/-   ##
=======================================
  Coverage   72.99%   72.99%           
=======================================
  Files           4        4           
  Lines         137      137           
  Branches       51       51           
=======================================
  Hits          100      100           
  Misses         24       24           
  Partials       13       13           

☔ View full report in Codecov by Harness.
📢 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.

@alexander-akait
alexander-akait merged commit 667cb17 into main Sep 4, 2026
15 of 19 checks passed
@alexander-akait
alexander-akait deleted the claude/expose-loader-deprecation-y2rp9w branch September 4, 2026 09:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant