Interface: PartialResolvedId
Extends
SpecifiedModuleOptionsPartial<PartialNull<ModuleOptions>>
Properties
attributes?
- Type:
Record<string,string> - Optional
Replaces the import attributes of the import. {} removes them. If omitted, the import keeps its own attributes.
For an external module, they become the with clause of the import in the output. Without experimental.importAttributes, they are ignored.
description?
- Type:
string|null - Optional
A short, human-readable description of the module.
This is useful for virtual modules, whose ids (e.g. \0vite/modulepreload-polyfill.js) do not convey their purpose on their own.
Example
function polyfillPlugin() {
return {
name: 'vite:modulepreload-polyfill',
load: {
filter: { id: /^\0vite/modulepreload-polyfill\.js$/ },
handler(id) {
return {
code: '',
description: 'A polyfill for `link` tag with `rel="modulepreload"`',
};
}
},
};
}Inherited from
external?
- Type:
boolean|"absolute"|"relative" - Optional
Whether this id should be treated as external.
Relative external ids, i.e. ids starting with ./ or ../, will not be internally converted to an absolute id and converted back to a relative id in the output, but are instead included in the output unchanged. If you want relative ids to be re-normalized and deduplicated instead, return an absolute file system location as id and choose external: "relative".
- If
true, absolute ids will be converted to relative ids based on the user's choice for themakeAbsoluteExternalsRelativeoption. - If
'relative', absolute ids will always be converted to relative ids. - If
'absolute', absolute ids will always be kept as absolute ids.
id
- Type:
string
The resolved id, without import attributes.
invalidate?
- Type:
boolean|null - Optional
Inherited from
meta?
- Type:
CustomPluginOptions|null - Optional
See Custom module meta-data section for more details.
Inherited from
moduleSideEffects?
- Type:
ModuleSideEffects - Optional
Indicates whether the module has side effects to Rolldown.
- If
falseis set, Rolldown treats the module as side-effect-free. It may drop a bare import or resolve a re-export directly to its defining module. - If
trueis set, Rolldown analyzes bundled modules for side effects, bypassing thetreeshake.moduleSideEffectsoption and packagesideEffectsmetadata. External modules use Rolldown's default side-effect assumptions. - If
"no-treeshake"is set, treeshaking will be disabled for this module, and this module will be included in one of the chunks even if it is empty.
The precedence of this option is as follows (highest to lowest):
transformhook's returnedmoduleSideEffectsoptionloadhook's returnedmoduleSideEffectsoptionresolveIdhook's returnedmoduleSideEffectsoptiontreeshake.moduleSideEffects, when the option supplies a verdict for the modulesideEffectsfield inpackage.jsonfor bundled modules- Static analysis for bundled modules and Rolldown's default side-effect assumptions for external modules
this.getModuleInfo(id).moduleSideEffects and this.resolve(id).moduleSideEffects report the effective setting. They report true when Rolldown falls back to statement analysis, regardless of the analysis result. An external module that falls back to the default assumption of side effects also reports true when no hook supplies a value.
With treeshake: false, a hook's true keeps tree-shaking disabled. The APIs report true unless a hook returns false or "no-treeshake".
Inherited from
SpecifiedModuleOptions.moduleSideEffects
packageJsonPath?
- Type:
string|null - Optional