Skip to content

[Feature Request]: renderDynamicImport hook #4532

Description

@michielpauw

What problem does this feature solve?

In our Rollup build, we use the renderDynamicImport hook to identify a specific dynamic import, to manipulate this for a later stage of the build. The manipulation itself can be done using the transform hook. However, correctly identifying this import requires the options.targetModuleId and options.moduleId properties passed to renderDynamicImport.

Example:

renderDynamicImport(options) {
  if (
    !options.targetModuleId &&
    options.moduleId.includes('/some/dynamic/import')
  ) {
    return { left: 'import(/* webpackIgnore: true */', right: ')' };
  }
  return undefined;
},

What does the proposed API look like?

Implement renderDynamicImport with the same API as Rollup: https://rollupjs.org/plugin-development/#renderdynamicimport

Metadata

Metadata

Assignees

No one assigned

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions