Appearance
Are you an LLM? You can read better optimized documentation at /options/shim-missing-exports.md for this page in Markdown format
shimMissingExports
类型:
boolean¥Type:
boolean默认值:
false¥Default:
false
当 true 设置为 true 时,会为缺失的导出创建填充变量,而不是抛出错误。
¥When true, creates shim variables for missing exports instead of throwing an error.
示例
¥Examples
启用 shimming
¥Enable shimming
js
export default {
shimMissingExports: true,
};示例场景
¥Example scenario
module-a.js:
js
export { nonExistent } from './module-b.js';module-b.js:
js
// nonExistent is not actually exported here
export const something = 'value';使用 shimMissingExports: false(默认)时,这会引发错误。使用 shimMissingExports: true,Rolldown 将创建一个填充变量:
¥With shimMissingExports: false (default), this would throw an error. With shimMissingExports: true, Rolldown will create a shim variable:
js
// Bundled output (simplified)
const nonExistent = undefined;
export { nonExistent, something };