fix: remove node:module/require and update import statements to use node: prefix#3567
fix: remove node:module/require and update import statements to use node: prefix#3567y-okady wants to merge 1 commit intokintone:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the module import statements in the rest-api-client package by adding the node: prefix to Node.js built-in module imports and replacing a CommonJS require statement with an ES module import.
Changes:
- Updated all Node.js built-in module imports in
node.tsto use thenode:prefix (fs, util, path, https, os) - Converted
package.jsonimport from CommonJSrequire()to ES moduleimportstatement innode.ts - Simplified
index.mjsto directly export from the ESM build instead of usingmodule.createRequire
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/rest-api-client/src/platform/node.ts | Added node: prefix to built-in module imports and converted package.json from require to import |
| packages/rest-api-client/index.mjs | Simplified to directly export from ESM build, removing module.createRequire pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@y-okady |
|
@hisasami I tested the package execution in both CommonJS (CJS) and ES Modules (ESM) environments without any changes from this PR. CJS works fine when executed with // index.cjs
const { KintoneRestAPIClient } = require("@kintone/rest-api-client");However, ESM does not work when executed with // index.mjs
import { KintoneRestAPIClient } from "@kintone/rest-api-client";This results in the following error: This error appears to originate from the existing implementation in the SDK (specifically the import in src/index.ts#L1), which is outside the scope of the changes introduced in this PR. Would you like me to address this issue as part of this PR, or should it be handled separately? |
|
@y-okady |
Why
#3568
What
How to test
Checklist
pnpm lintandpnpm teston the root directory.