@react-aria/i18n@3.13.0 ESM entry fails in Netlify SSR: private useMessageFormatter.js has no named export
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 58
Description
### Provide a general summary of the issue here
## Summary
After upgrading dependencies, our Netlify SSR function started failing at
runtime when importing `@react-aria/i18n@3.13.0`.
The package ESM entry `dist/import.mjs` imports:
```js
import { useMessageFormatter } from "./private/useMessageFormatter.js";
```
In the Netlify runtime, that private `.js` file appears to be interpreted in a
way that does not expose the named ESM export, causing the SSR function to
crash.
## Error
```text
SyntaxError: The requested module './private/useMessageFormatter.js' does not provide an export named 'useMessageFormatter'
file:///var/task/node_modules/.pnpm/@react-aria+i18n@3.13.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@react-aria/i18n/dist/import.mjs:1
import {useMessageFormatter as ...} from "./private/useMessageFormatter.js";
^^^^^^^^^^^^^^^^^^^
```
## Environment
- `@react-aria/i18n`: `3.13.0`
- `react`: `19.2.4`
- `react-dom`: `19.2.4`
- Package manager: `pnpm`
- Runtime/deploy target: Netlify SSR function
- Node version: `24.14.0`
- Bundler/framework: Vite / TanStack Start / Netlify adapter
## Local reproduction signal
This reproduces locally when running Node with module syntax detection disabled:
```sh
node --no-experimental-detect-module --input-type=module -e "import('@react-aria/i18n')"
```
## Expected behavior
`@react-aria/i18n` should be importable in Node SSR environments and should
expose `useMessageFormatter` without relying on runtime-specific interpretation
of private `.js` files.
## Workaround
Bundling the dependency into the SSR output avoids the crash:
```ts
// vite.config.ts
export default defineConfig({
ssr: {
noExternal: ["@react-aria/i18n"],
},
});
```
In our app, this dependency is pulled through `@heroui/react@3.0.3`, so we also
bundled `@heroui/react`.
## Question
Is `@react-aria/i18n@3.13.0` expected to work in Node SSR environments where
package-private `.js` files are not interpreted as ESM via syntax detection? If
so, could the package publish metadata or file extensions be adjusted so
`dist/import.mjs` can safely import the private module?
### 🤔 Expected Behavior?
`@react-aria/i18n` should be importable in Node SSR environments and should
expose `useMessageFormatter` without relying on runtime-specific interpretation
of private `.js` files.
### 😯 Current Behavior
App breaks on netlify with:
```text
SyntaxError: The requested module './private/useMessageFormatter.js' does not provide an export named 'useMessageFormatter'
file:///var/task/node_modules/.pnpm/@react-aria+i18n@3.13.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@react-aria/i18n/dist/import.mjs:1
import {useMessageFormatter as ...} from "./private/useMessageFormatter.js";
^^^^^^^^^^^^^^^^^^^
```
### 💁 Possible Solution
## Workaround
Bundling the dependency into the SSR output avoids the crash:
```ts
// vite.config.ts
export default defineConfig({
ssr: {
noExternal: ["@react-aria/i18n"],
},
});
```
### 🔦 Context
I updated my tanstack start app packages to latest versions of Hero ui and React aria
### 🖥️ Steps to Reproduce
1. Install `@react-aria/i18n@3.13.0` in a Node SSR project.
2. Import `@react-aria/i18n` from an SSR/server entry or from a dependency that
is externalized by the server bundle.
3. Run the server bundle in a runtime where package-private `.js` files are not
interpreted as ESM via syntax detection. For example:
```sh
node --no-experimental-detect-module --input-type=module -e "import('@react-aria/i18n')"
```
4. Observe the runtime import failure for
`./private/useMessageFormatter.js`.
### Version
@react-aria/i18n: 3.13.0
### What browsers are you seeing the problem on?
Chrome
### If other, please specify.
_No response_
### What operating system are you using?
macOS
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Research direction
Start with dist/import.mjs and private/useMessageFormatter.js, then run the reported Node command with @react-aria/i18n 3.13.0 in an externalized SSR setup. Done means the package imports successfully and exposes useMessageFormatter without requiring the Vite ssr.noExternal workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, react, typescript, vite
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100