-
Notifications
You must be signed in to change notification settings - Fork 89
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
Switch from rollup to vite, from commonjs to ecmascript modules #1740
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1740 +/- ##
=======================================
Coverage 98.20% 98.21%
=======================================
Files 18 17 -1
Lines 1562 1565 +3
Branches 333 333
=======================================
+ Hits 1534 1537 +3
Misses 28 28 ☔ View full report in Codecov by Sentry. |
"typings": "./dist/types/index.d.ts", | ||
"types": "./dist/types/index.d.ts", |
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.
EXPLAINER: These are no longer required, as exports
below contains the types, and TypeScript primarily looks there.
"main": "./dist/bundles/meilisearch.cjs", | ||
"module": "./dist/bundles/meilisearch.mjs", |
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.
EXPLAINER: "exports"
is the replacement for these and we no longer officially support Node.js versions prior to 18, so we do not need the backwards compatibility.
a83e48d
to
bb95a1c
Compare
bb95a1c
to
7b440ed
Compare
Hey @brunoocasali, it's been a while. Please, can you take a look at this PR? It would unblock me from contributing even more, for instance using |
I support this change too 👍 However, I would recommend making this non-breaking for users. For the exports: I would add information in the documentation to explain that default export is deprecated, will be removed one day, and named export should be preferred. For the UMD bundle: is there a way to approach it in the same way? Via documentation, and roll out the breaking change in the future. |
Thanks for the feedback, I'll try to do just that. |
Hey @Strift, I've reverted the default export change, and deprecated it instead. However I couldn't find a solution for the second breaking change. At least not a straight forward one, I don't think it's worth hacking around with it though too much. That one's either extending |
@brunoocasali @Strift No good? |
@brunoocasali @Strift Hey, I managed to make this a non breaking change. |
> [!WARNING] | ||
> [Default export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export#using_the_default_export) is deprecated and will be removed in a future version. [Issue](https://github.com/meilisearch/meilisearch-js/issues/1789). | ||
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.
Is this fine here? Or should it just be in the release notes? If it's fine should I also mention the window
deprecation as well here?
Pull Request
Related issue
Fixes #1626
Waiting on #1739What does this PR do?
rollup
tovite
, which internally usesrollup
, but makes things a lot shorter and simplervitest.config.js
scripts/file-size.js
, packageskleur
,pretty-bytes
,brotli-size
,gzip-size
, as it prints sizes by defaultrollup
plugins and dependencies (@rollup/plugin-terser
,@babel/core
,@babel/preset-env
,@rollup/plugin-babel
,@rollup/plugin-commonjs
,@rollup/plugin-json
,@rollup/plugin-node-resolve
,rollup-plugin-typescript2
)shx
package, andcleanup
script, as it clearsdist
itself"type": "module"
).js
project file now needs to be written in ESM syntax, the web standard syntaxtsconfig.json
according to https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html#im-writing-a-librarymodule
tonode16
andverbatimModuleSyntax
totrue
, this requires changes to all TypeScript files so they may be compatible with the web standard ESM.js
extensionindex
directory imports, as that is only a Node.js thing, the web doesn't support ittype
keywordWarning
Warning
window
with the exports in the future, instead it will only extend it with propertymeilisearch
which contains the exports Do not extendwindow
with all of the exports in UMD bundle, rather just a property ofwindow
#1806Old
New
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!