Skip to content

Interface: PartialResolvedId ​

Extends ​

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 ​

js
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 ​

ModuleOptions.description


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 the makeAbsoluteExternalsRelative option.
  • 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 ​

ModuleOptions.invalidate


meta? ​

See Custom module meta-data section for more details.

Inherited from ​

ModuleOptions.meta


moduleSideEffects? ​

  • Type: ModuleSideEffects
  • Optional

Indicates whether the module has side effects to Rolldown.

  • If false is 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 true is set, Rolldown analyzes bundled modules for side effects, bypassing the treeshake.moduleSideEffects option and package sideEffects metadata. 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):

  1. transform hook's returned moduleSideEffects option
  2. load hook's returned moduleSideEffects option
  3. resolveId hook's returned moduleSideEffects option
  4. treeshake.moduleSideEffects, when the option supplies a verdict for the module
  5. sideEffects field in package.json for bundled modules
  6. 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

Inherited from ​

ModuleOptions.packageJsonPath

Was this page helpful?