﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>---
url: /reference/Interface.ModuleInfo.md
---
# Interface: ModuleInfo

## Extends

* [`ModuleOptions`](Interface.ModuleOptions.md)

## Properties

### code

* **Type**: `string` | `null`

The source code of the module.

`null` if external or not yet available.

***

### description?

* **Type**: `string`
* **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`](Interface.ModuleOptions.md).[`description`](Interface.ModuleOptions.md#description)

***

### dynamicallyImportedIds

* **Type**: `string`\[]

The module ids dynamically imported by this module.

***

### dynamicImporters

* **Type**: `string`\[]

The ids of all modules that dynamically import this module.

***

### exports

* **Type**: `string`\[]

All exported variables.

`*` stands for `export * from`. Names starting with `*` are listed with an additional `*` to keep them apart from it.

***

### id

* **Type**: `string`

The id of the module for convenience

***

### importedIds

* **Type**: `string`\[]

The module ids statically imported by this module.

***

### importers

* **Type**: `string`\[]

The ids of all modules that statically import this module.

***

### inputFormat

* **Type**: `"es"` | `"cjs"` | `"unknown"`
* **Experimental**

The detected format of the module, based on both its syntax and module definition
metadata (such as `package.json` `type` and file extensions like `.mjs`/`.cjs`/`.mts`/`.cts`).

* "esm" for ES modules (has `import`/`export` statements or is defined as ESM by module metadata)
* "cjs" for CommonJS modules (uses `module.exports`, `exports`, top-level `return`, or is defined as CommonJS by module metadata)
* "unknown" when the format could not be determined from either syntax or module definition metadata

***

### isEntry

* **Type**: `boolean`

Whether this module is a user- or plugin-defined entry point.

***

### meta

* **Type**: [`CustomPluginOptions`](Interface.CustomPluginOptions.md)

See [Custom module meta-data section](/apis/plugin-api/inter-plugin-communication#custom-module-meta-data) for more details.

#### Inherited from

[`ModuleOptions`](Interface.ModuleOptions.md).[`meta`](Interface.ModuleOptions.md#meta)

***

### moduleSideEffects

* **Type**: `ModuleSideEffects`

The `moduleSideEffects` value of the module, which tree shaking starts from. `true` means
that tree shaking checks the statements of the module, so a module without side effects can
still have `true`.

It is the last value that a hook returned or that a plugin wrote to this property: the
`resolveId` result that created the module, then the `load` and `transform` results of the
module. A hook result of `null` or `undefined` does not change it. When no hook returned a
value and no plugin wrote one, it is the first value from these steps:

1. The value that the `treeshake.moduleSideEffects` option gives for the module.
2. For an external module: `false` for a Node.js built-in, and `true` for any other one.
   For any other module: the `sideEffects` field of its `package.json`. Rolldown uses this
   field only when its own resolver resolved the module. This is also the case when a
   `resolveId` hook returned a `this.resolve` result that Rolldown's resolver gave. When a
   hook returned its own id, such as a virtual module, Rolldown does not use the field.
3. `true`.

Writing `null` or `undefined` clears the value, so the steps above give it again. Earlier
hook results and written values do not come back.

See [`getModuleInfo`](/reference/Interface.PluginContext#getmoduleinfo)
for when the value is available and when a change reaches tree shaking.

#### Overrides

[`ModuleOptions`](Interface.ModuleOptions.md).[`moduleSideEffects`](Interface.ModuleOptions.md#modulesideeffects)

***

### packageJsonPath?
