[Feature]: support get import attributes in NormalModuleFactory resolve hook #8770
Labels
feat
New feature or request
pending triage
The issue/PR is currently untouched.
team
The issue/pr is created by the member of Rspack.
What problem does this feature solve?
In order to better support Import Attributes, we need to support
attributes
in NormalModuleFactory resolve hook.export type ResolveData = { contextInfo: ContextInfo; context: string; request: string; + attributes?: Record<string, any>; fileDependencies: string[]; missingDependencies: string[]; contextDependencies: string[]; createData?: CreateData; };
By the way, this feature is already supported in webpack, but the key name is
assertions
.https://github.com/webpack/webpack/blob/5e09d0e05f243d8d2c14c9fe140eba32b7aaeac7/types.d.ts#L12442
What does the proposed API of configuration look like?
compiler.hooks.compilation.tap( 'MyPlugin', (compilation, { normalModuleFactory }) => { normalModuleFactory.hooks.resolve.tap('MyPlugin', resolveData => { + console.log(resolveData.attributes); }); }, );
The text was updated successfully, but these errors were encountered: