Skip to content

input

  • 类型:string | string[] | Record<string, string>

    ¥Type: string | string[] | Record<string, string>

  • 可选:否 ⚠️

    ¥Optional: No ⚠️

定义 bundle 的入口模块的入口和位置。相对路径基于 cwd 选项进行解析。

¥Defines entries and location(s) of entry modules for the bundle. Relative paths are resolved based on the cwd option.

示例

¥Examples

单个条目

¥Single entry

js
export default defineConfig({
  input: 'src/index.js',
});

多个条目

¥Multiple entries

js
export default defineConfig({
  input: ['src/index.js', 'src/vendor.js'],
});

命名多个条目

¥Named multiple entries

js
export default defineConfig({
  input: {
    'index': 'src/index.js',
    'utils': 'src/utils/index.js',
    'components': 'src/components/index.js',
  },
});

深入探讨

¥In-depth

input 允许你在打包过程中指定一个或多个 entriesnames

¥input allows you to specify one or more entries with names for the bundling process.

当指定多个条目(数组或对象)时,Rolldown 将为每个条目创建单独的 入口块

¥When multiple entries are specified (either as an array or an object), Rolldown will create separate entry chunks for each entry.