elements
elements copied to clipboard
@ory/elements-react’s ESM build imports an internal file without an extension
Preflight checklist
- [x] I could not find a solution in the existing issues, docs, nor discussions.
- [x] I agree to follow this project's Code of Conduct.
- [x] I have read and am following this repository's Contribution Guidelines.
- [x] I have joined the Ory Community Slack.
- [x] I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe the bug
## Error Type
Runtime Error
## Error Message
Failed to load external module @ory/elements-react/theme: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/meotimdihia/Sources/myproject/node_modules/@ory/elements-react/dist/client/session-provider' imported from /Users/meotimdihia/Sources/myproject/node_modules/@ory/elements-react/dist/client/index.mjs
at async (.next/server/chunks/ssr/[root-of-the-server]__52545ad9._.js:7:13)
Next.js version: 15.5.4 (Turbopack)
e.g. the code:
import { frontendClient } from "./frontendClient";
doesn't work, it need to change to
import { frontendClient } from "./frontendClient.mjs";
Reproducing the bug
npm run dev in next.js project.
in package.json the project is using ESM "type": "module"
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"lib": ["DOM.Iterable", "ESNext", "DOM", "WebWorker"],
"sourceMap": true,
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": "./",
"paths": {
"@/*": ["./*"]
},
"plugins": [
{
"name": "next"
}
]
},
"include": [
"types.d.ts",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"**/*.d.ts"
],
"exclude": ["node_modules", ".next/types/validator.ts"]
}
Relevant log output
Relevant configuration
Version
"@ory/elements-react": "^1.0.0", "@ory/nextjs": "^1.0.0-rc.0",
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
Docker Compose
Additional Context
No response