-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: read correct type definitions when using ESM #87
Conversation
@sun-yryr And, a way I found (but not smart) is adding named export to import { AthenaQuery } from "./athena-query";
export default AthenaQuery;
// Add this line
export { AthenaQuery } from "./athena-query"; And users will use it when using ESM; import { AthenaQuery } from "@classmethod/athena-query";
const athenaQuery = new AthenaQuery(athena); It will work without any breaking changes, but cannot provide default exported class.😕 JapaneseこのIssueとPRを作成していただきありがとうございます! そして、私が見つけた方法(賢くないが)は、 import { AthenaQuery } from "./athena-query";
export default AthenaQuery;
// Add this line
export { AthenaQuery } from "./athena-query"; そして、ユーザーはESMを使用するときにそれを使用します。 import { AthenaQuery } from "@classmethod/athena-query";
const athenaQuery = new AthenaQuery(athena); これは、破壊的な変更なしに機能しますが、デフォルトエクスポートされたクラスを提供することはできません。😕 |
@yamatatsu JapanesePR の確認ありがとうございます! I have run the following commands locally and confirmed the contents of the dist directory:
|
@sun-yryr mv dist dist_
pnpm build
diff dist dist_ But no difference was found.🤔 It means the 5 files had been created with the |
And you can see the files on the repository npm hosted. |
Actually I'm not familiar to unbuild...😅 But Same code as the code before modified is written in official example. In Japanese; |
@yamatatsu |
@sun-yryr Thank you to your super kindness explanation!!😭 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Released as v1.4.0. https://www.npmjs.com/package/@classmethod/athena-query |
fixed #86
Summary
Modified package.json to use the appropriate type definition files based on CJS/ESM.
The necessary files have already been output by pnpm build.
Changes
Modified package.json to use the appropriate type definition files based on CJS/ESM.
Output Directories (pnpm build)
Japanese
概要
package.json
を修正し、CJS/ESM に応じた型定義ファイルを使用するようにしました。必要なファイルはすでに pnpm build で出力されています。
変更内容
CJS/ESM に応じた型定義ファイルを使用する形に
package.json
を修正出力されたディレクトリ (pnpm build)