Skip to content

Failed to load config in Vite 7 with Node 22.12.0 #20297

Closed as not planned
Closed as not planned
@keisha-rw

Description

@keisha-rw

Documentation is

  • Missing
  • Outdated
  • Confusing
  • Not sure?

Explain in Detail

After upgrading from the latest v6 to Vite 7, our build started failing with the following message (path names are redacted with XXX):

failed to load config from /Users/XXX/packages/icons-web/build/external/vite.config.ts
      error during build:
      Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/XXX/node_modules/vite/dist/node/index.js from /Users/XXX/packages/icons-web/build/external/vite.config.ts not supported.
      Instead change the require of index.js in /Users/XXX/packages/icons-web/build/external/vite.config.ts to a dynamic import() which is available in all CommonJS modules.
          at _require.extensions.<computed> [as .js] (file:///Users/XXX/node_modules/vite/dist/node/chunks/dep-Bsx9IwL8.js:36481:9)
          at TracingChannel.traceSync (node:diagnostics_channel:315:14)
          at Object.<anonymous> (/Users/XXX/packages/icons-web/build/external/vite.config.ts:36:19)

The migration guide states that v22.12+ is required, but this is broken for us on v22.12. https://vite.dev/guide/migration.html

Updating to v22.13.0+ resolves the issue, so the documentation may just need updated to state that v22.13.0+ is the required version.

Your Suggestion for Changes

Please update the migration guide for Vite 7 to state that Node v22.13.0+ is required

Reproduction

No response

Steps to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions