Skip to content

Astro 6: Build crashes with [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" #15856

@phenomen

Description

@phenomen

Astro Info

Astro                    v6.0.3
Node                     v24.14.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

N/A

Describe the Bug

After updating to Astro 6, my build crashes on bits-ui dependency with error:

 generating static routes
12:56:16   ├─ /index.html12:56:16 [ERROR] TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for C:\dev\issue-astro-svelte-bits-ui\node_modules\.pnpm\bits-ui@2.16.3_@internationalized+date@3.12.0_svelte@5.53.10\node_modules\bits-ui\dist\bits\accordion\components\accordion.svelte
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:185:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:211:36)
    at defaultLoadSync (node:internal/modules/esm/load:158:16)
    at #loadAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:796:12)
    at #loadSync (node:internal/modules/esm/loader:816:49)
    at ModuleLoader.load (node:internal/modules/esm/loader:781:26)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:526:31)
    at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:577:36)
    at afterResolve (node:internal/modules/esm/loader:625:52)
    at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:631:12)
12:56:16 [ERROR] [build] Caught error rendering /: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for C:\dev\issue-astro-svelte-bits-ui\node_modules\.pnpm\bits-ui@2.16.3_@internationalized+date@3.12.0_svelte@5.53.10\node_modules\bits-ui\dist\bits\accordion\components\accordion.svelte
Unknown file extension ".svelte" for C:\dev\issue-astro-svelte-bits-ui\node_modules\.pnpm\bits-ui@2.16.3_@internationalized+date@3.12.0_svelte@5.53.10\node_modules\bits-ui\dist\bits\accordion\components\accordion.svelte
  Hint:
    You likely need to add this package to `vite.ssr.noExternal` in your astro config file.
  Stack trace:
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:185:9)
    at defaultLoadSync (node:internal/modules/esm/load:158:16)
    at #loadSync (node:internal/modules/esm/loader:816:49)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:526:31)
    at afterResolve (node:internal/modules/esm/loader:625:52)
 ELIFECYCLE  Command failed with exit code 1.

Adding it to noExternal, as suggested in the log, does not fix the issue.

// astro.config.mjs
  vite: {
    ssr: {
      noExternal: ['bits-ui']
    }
  },

What's the expected result?

Build not crashing

Link to Minimal Reproducible Example

https://github.com/phenomen/issue-astro-svelte-bits-ui

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions