Skip to content

[Feature]: Define module_id_to_filename Via Configuration #10292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dtothefp opened this issue May 7, 2025 · 0 comments
Open

[Feature]: Define module_id_to_filename Via Configuration #10292

dtothefp opened this issue May 7, 2025 · 0 comments
Labels
pending triage The issue/PR is currently untouched.

Comments

@dtothefp
Copy link

dtothefp commented May 7, 2025

What problem does this feature solve?

We are building Rspack apps in CI in non deterministic tmp directories, something like tmp/<unique_hash/app and therefore the variable names being defined (I believe by module_id_to_filename for imported modules is changing per build which breaks caching. Ideally we could define the variable naming structure via configuration with a function or a string template.

example of issue:

var _private_var_folders_8f_jdj3yc313y5fkz6ms6866tqw0000gp_T_tmp_16642tEeuhJvQGtV0_rspack_archive_preact_static_1_1_compat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact_static_1_1_compat_js__WEBPACK_IMPORTED_MODULE_0__);

I was looking through the source code and saw FetchCompileAsyncWasmPlugin but I don't think that hooks into the variable naming?

What does the proposed API of configuration look like?

Ideally we could define this via a plugin or rspack.config.js

// rspack.config.js

module.exports = {
  experiments: {
     rspackFuture: { 
       bundlerVarNaming: // function or template string
    },
  },
}

or a plugin that allows for custom var naming for __webpack_require__

@dtothefp dtothefp added the pending triage The issue/PR is currently untouched. label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

1 participant