-
-
Notifications
You must be signed in to change notification settings - Fork 140
feat!: move to ESM-only (CJS generation format also dropped) #448
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR transitions the project to ESM-only by removing support for CJS generation, updating file system path handling, and revising function signatures to simplify usage. Key changes include:
- Removal of the "format" option and related CJS logic in the configuration and build process.
- Refactoring of path functions to use resolve and pathToFileURL for consistency and Windows compatibility.
- Updates to client-side entry functions and documentation to reflect the ESM-only approach.
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/types.ts | Removed the "format" option from ViteSSGOptions to enforce ESM-only mode. |
src/node/build.ts | Updated path handling and removed CJS-specific logic; adjusted createApp signature. |
src/client/single-page.ts | Simplified createApp by removing the unused client parameter. |
src/client/index.ts | Simplified createApp function signature by removing the client parameter. |
build.config.ts | Updated build configuration for ESM-only mode and removed emitCJS option. |
README.md | Updated docs to announce ESM-only support and added a tree-shaking guide. |
Files not reviewed (1)
- package.json: Language not supported
Co-authored-by: Copilot <[email protected]>
# Conflicts: # package.json
don't merge yet, I'm going to update pwa plugin to 1.0.0, I'm having some issues with workbox-* deps resolving to lower 7.0.0 and should use 7.3.0 once pwa plugin updated to 1.0.0 done |
We'll need to add some test to test Rollup tree-shaking using @kevinmarrec iirc you want to add more tests here, we should check previous comment before releasing this 🤞 |
NOTE: @kevinmarrec the ofc, if |
@userquin Please check this REPL and play with I think we should drop |
so, we just need to remove the entry from the readme here, thx |
Tested this PR against my project, went smoothly, and won additional
|
We should deprecate the |
Makes sense, |
We should add also a |
Co-authored-by: Kevin Marrec <[email protected]>
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
Description
This PR includes the following changes:
format
from SSG options, CJS output format removedresolve
insteadjoin
on the build module to avoid problems with Windows file systempathToFileURL(resolve(...)).href
removing the prefix and win32 checkclient
argument fromcreateApp
function (client, spa and build modules)eslint.config.mjs
toeslint.config.js
.mjs
without types (typesVersions
still there to support Node10)node16
and removedrollup.emitCJS
ESM-only from v27.0.0 (CJS generation format also dropped).
at top and new tree-shaking sectionisClient
Will require changes from this PR #447 to test this PR in local examples...
Linked Issues
Additional context
From this comment #442 (comment)