Skip to content

[Feature Request]: renderDynamicImport hook #4532

@michielpauw

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions