-
Notifications
You must be signed in to change notification settings - Fork 128
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
Re-introduce CommonJS support to SDK #686
Comments
Noted, I'm surprised though you can't use hydrogen-view-sdk as an ES module though from your commonjs project with node. Are you using an older version of node? |
Node.js v16.14.0 If you try to
|
While trying to solve this, I think I stumbled upon what the |
Fix #686 Fix #682 Instead of deleting the whole `target/` directory, leave it alone so the symlink driving the `npm link`/`yarn link` stays in tact. Leave Vite builds in their build directories (`/lib-build`/`/asset-build`) so you can `vite build --watch` to build on local changes and still have a consisent place to reference in the `package.json` `exports`. Previously, everything relied on `build.sh` which does a bunch of moving and renaming and made it hard to rebuild on changes. Add back support for CommonJS (adding the `package.json` `exports`). The last piece is making sure the `?url` imports (`import workerPath from 'hydrogen-view-sdk/main.js?url';`) work still. It looks like this may have just been solved via vitejs/vite#6725 -> vitejs/vite#7073 (literally 2 days ago) and we just need to wait for the next Vite release 🎉
It looks like this may have just been fixed by vitejs/vite#6725 -> vitejs/vite#7073 (literally 2 days ago) and we just need to wait for the next Vite release 🎉 Re-introduced the CommonJS exports in #693 and will try it out the new Vite release |
Commented on the status of this in the PR #693 (comment)
|
It's not quite clear what the original problem is or how to reproduce but https://github.com/vector-im/hydrogen-web/pull/633/files removed CommonJS
exports
from thepackage.json
to workaround a Vite bug.With https://github.com/matrix-org/matrix-public-archive, I'm requiring
hydrogen-view-sdk
in Node.js. I'm currently working around the CommonJS support by just manually updatingpackage.json
with theexports
again.package.json
The text was updated successfully, but these errors were encountered: