Skip to content

dynamicImportInCjs ​

  • Type: boolean
  • Optional

Whether to keep external dynamic imports as import(...) expressions in CommonJS output.

If set to false, external dynamic imports will be rewritten to use require(...) calls. An import() with a second argument, such as { with: { type: 'json' } }, stays an import(), because require() cannot carry import attributes. This may be necessary to support environments that do not support dynamic import() in CommonJS modules like old Node.js versions.

Default ​

ts
true

Was this page helpful?