RFC: Refactoring internal module variable naming in Rspack output #12244
chenjiahan
started this conversation in
RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This RFC proposes a refinement of the internal module variable naming conventions used in Rspack's generated output.
The goal is to improve readability, reinforce Rspack’s branding, and reduce unnecessary verbosity. The new approach adopts a consistent
__rspack_prefix instead of__webpack_and__WEBPACK_, shortens excessively long suffix segments, and unifies the naming style using lowercase identifiers.These names are internal implementation details, so the change is not expected to introduce breaking behavior. We will roll out the adjustments gradually and may revert specific parts if any incompatibility is discovered.
Motivation
Rspack currently uses naming patterns inherited from webpack, for example:
These identifiers are verbose and visually heavy. A cleaner naming scheme makes compiled output easier to understand and debug, and it reinforces clear attribution to Rspack. (See also webpack/webpack#6266)
Proposal
The updated naming rules are:
__rspack_for all internal variables.imported_moduleormodule_reference.Examples
All Variables
Here are all the known module internal variable names and their new names:
__webpack_require____rspack_require__webpack_exports____rspack_exports__unused_webpack_exports__rspack_unused_exports__webpack_module____rspack_module__unused_webpack_module__rspack_unused_module__webpack_async_dependencies____rspack_async_dependencies__webpack_handle_async_dependencies____rspack_handle_async_dependencies__webpack_unused_export____rspack_unused_export__webpack_used_export____rspack_used_export__webpack_inlined_export____rspack_inlined_export__webpack_provide___rspack_provide___webpack_exports_export____rspack_exports_export__webpack_export_target____rspack_export_target__webpack_exports_default____rspack_exports_default__webpack_dirname____rspack_dirname__webpack_fileURLToPath____rspack_fileURLToPath__WEBPACK_EXTERNAL_MODULE_foo____rspack_external_foo__WEBPACK_EXTERNAL_createRequire__rspack_createRequire__WEBPACK_EXTERNAL_createRequire_require__rspack_createRequire_require__WEBPACK_DEFAULT_EXPORT____rspack_default_export__WEBPACK_NAMESPACE_OBJECT_foo__rspack_namespace_foo__WEBPACK_IMPORTED_MODULE_foo__rspack_import_foo__WEBPACK_MODULE_REFERENCE_foo__rspack_module_ref_foo__WEBPACK_MODULE_DYNAMIC_REFERENCE_foo__rspack_module_dynamic_ref_foo__WEBPACK_AMD_REQUIRE_ARRAY____rspack_amd_require_array__WEBPACK_AMD_DEFINE_RESULT____rspack_amd_define_result__WEBPACK_LOCAL_MODULE_foo__rspack_local_foo__WEBPACK_REEXPORT_OBJECT____rspack_reexport__WEBPACK_IMPORT_KEY____rspack_import_key__WEBPACK_OUTDATED_DEPENDENCIES____rspack_outdated_depsBeta Was this translation helpful? Give feedback.
All reactions