-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
rollup fix #1527
rollup fix #1527
Conversation
ryoppippi
commented
Mar 1, 2025
- modify rollup config to generate submodules in esm format
- add .js prefix to @samchon/openapi because in esm we need to add extension when we import scripts
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
commit: |
33a6082
to
b0d1717
Compare
@samchon I'l| write |
This reverts commit b0d1717.
Resolves import issues with @samchon/openapi by automatically adding .mjs extension to import statements and external module resolution. This ensures proper module loading in ESM environments.
fixed! Please check the output file using |
const ext = `mjs`; | ||
const nodeModulesDir = `node_modules`; | ||
if (chunkInfo.name.includes(nodeModulesDir)) { | ||
throw new Error(`Invalid chunk name: ${chunkInfo.name}`); |
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.
all dependencies are now external.
{ | ||
name: "add-js-to-samchon-openapi", | ||
renderChunk(code) { | ||
return code.replace(/import (.+) from "(.+)"/g, (m, m1, m2) => { | ||
if(m2.startWith('@samchon/openapi/lib')) { | ||
return `import ${m1} from "${m2}.mjs"` | ||
} | ||
return m; | ||
}) | ||
}, | ||
resolveId(id) { | ||
if (id.startsWith("@samchon/openapi/lib")) { | ||
return { | ||
id: id + ".mjs", | ||
external: true, | ||
} | ||
} | ||
}, | ||
}, |
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.
convert @samchon/openapi/lib/~~
to @samchon/openapi/lib/~~.mjs
@samchon this resolves esm modules so please check it |
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.
Good, I will merge first, and would test at the next 3.0.1 patch update