AUR0021

Invalid module transform input: yyyy. Expected Promise or Object.

Error message

Invalid module transform input: yyyy. Expected Promise or Object.

Parameters

Input value (any)

Error explanation

This error occurs when a module loader or transformer receives an input that is neither a Promise nor an Object. The module loader expects to work with either a module object or a Promise that resolves to a module, and will throw this error if given an invalid type (such as a string, number, or null).

Common causes

  • Passing a primitive value (string, number, boolean, etc.) instead of a module or Promise to a module loader or transformer.

  • Accidentally passing null or undefined as the input.

  • Misconfigured dynamic import or require call.

How to fix

  • Ensure you are passing either a module object or a Promise that resolves to a module.

  • Check the value being passed to the module loader or transformer for typos or incorrect types.

  • If using dynamic imports, verify that the import or require call returns a Promise or module object.

Debugging tips

  • Check the stack trace to see where the invalid input was provided.

  • Add logging or breakpoints to inspect the value being passed to the module loader or transformer.

  • Review the code that constructs or imports modules to ensure correct types are used.

Last updated

Was this helpful?