rspack
rspack copied to clipboard
feat: support `LoaderContext.loadModule`
Summary
closes https://github.com/web-infra-dev/rspack/issues/3738 closes https://github.com/web-infra-dev/rspack/issues/7723
TODOs or existing bugs to fix:
- [ ] Resolver options of referenced modules should extend their parent modules'. Related to https://github.com/web-infra-dev/rspack/blob/833c058da7a9d1c2a15cd9be49065d7c75c7ed7a/tests/webpack-test/cases/loaders/issue-4959/loaders/index.js, "b" is defined in the browser field in
package.json
, but it's not resolved. - [ ] Handle module cycle. Related to https://github.com/web-infra-dev/rspack/blob/833c058da7a9d1c2a15cd9be49065d7c75c7ed7a/tests/webpack-test/cases/errors/load-module-cycle/index.js. Currently there seems no cycle detection in rspack (https://github.com/web-infra-dev/rspack/issues/6048).
- [ ] Other options that differ from the options of
importModule
:recursive
,connectOrigin
,checkCycle
Checklist
- [x] Tests updated (or not required).
- [x] Documentation updated (or not required).