You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's hard to serve the static assets like the SVG icons and fonts because they are spread out amongst the rest of the package files in the root package directory.
Describe the solution you'd like
Have all assets available to serve under hydrogen-view-sdk/assets/
Add "./assets/": "./asset-build/assets/" to the list of package.jsonexports
(node:46028) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./assets/" in the "exports" field module resolution of the package at C:\Users\MLM\Documents\GitHub\element\matrix-public-archive\node_modules\hydrogen-view-sdk\package.json.
Update this package.json to use a subpath pattern like "./assets/*".
Describe alternatives you've considered
Vite does have SSR support for running in Node.js but I didn't want to dive into all of that complexity yet as it's not necessary. Might switch over though.
Fix#686Fix#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 🎉
Is your feature request related to a problem? Please describe.
It's hard to serve the static assets like the SVG icons and fonts because they are spread out amongst the rest of the package files in the root package directory.
Describe the solution you'd like
hydrogen-view-sdk/assets/
"./assets/": "./asset-build/assets/"
to the list ofpackage.json
exports
asset-build
directory in the build scriptindex.js
likehydrogen-view-sdk/assets/index.js
sorequire.resolve('hydrogen-view-sdk/assets/')
can resolve the path properly.app.use(express.static(path.dirname(require.resolve('hydrogen-view-sdk/assets/'))));
In order to avoid the following deprecation notice, we probably want to use this instead:
"./assets/*": "./asset-build/assets/*"
to the list ofpackage.json
exports
require.resolve('hydrogen-view-sdk/assets/index.js')
Describe alternatives you've considered
Vite does have SSR support for running in Node.js but I didn't want to dive into all of that complexity yet as it's not necessary. Might switch over though.
Additional context
This makes
hydrogen-view-sdk
easier to work with if you're not using Vite although the SDK specifies that only Vite is supported though: "Currently, onlyvite
is supported" --doc/SDK.md
.hydrogen-view-sdk
currently doesn't even support CommonJS yet because of a Vite bug. Re-introducing CommonJS support is tracked by #686https://github.com/vector-im/hydrogen-web/blob/0ff1a01b429799e5ade9d21e0186ab0980b4add0/scripts/sdk/create-manifest.js#L5-L26
The text was updated successfully, but these errors were encountered: