Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

@ory/elements-react’s ESM build imports an internal file without an extension

未关闭
#573 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

@BetterAndBetterII 已经在做这个了。

开始于 2026年9月2日。

  • #604 来自 @BetterAndBetterII —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞

调研方向

从生成的 dist/client/index.mjs 及其对 session-provider 的导入开始,然后追踪对应的源代码导入,例如 ./frontendClient。在 ESM Next.js 项目中使用 npm run dev 复现;当 @ory/elements-react 能够在没有 ERR_MODULE_NOT_FOUND 的情况下加载时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug
Preflight checklist
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

主要语言
TypeScript
星标
187
派生
80
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ory/elements 的其他 Issue

查看 ory/elements 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。