Skip to content

feat: add Assets-import-attributes module for node/ssr env #11522

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ilhan007
Copy link
Member

Change

The change provides new entry point for assets (cldr, i18n and theming), called Assets-import-attributes.js.
This module is an alternative to Assets.js- the assets are only registered and loaded on the fly with dymamic imports when needed with added support for the with: { type: 'json' } import attribute, which is required in certain environments, such as Node.js with server-side rendering (SSR) - to properly load JSON files.

Example:

await import("../assets/i18n/messagebundle_bg.json", { with: { type: 'json' } });

Recommended usage: in environments that require SSR compatibility (e.g., Node.js).

Known issues

  • Webpack < 5.84: older versions of Webpack do not support the with: { type: 'json' } syntax and will fail to build.
  • Vite (dev mode): When using Vite, the development server may raise errors (e.g., expecting application/json) unless additional configuration is added to handle JSON imports with attributes.

@ilhan007 ilhan007 changed the title feat: add Assets-import-attributes for node/ssr env feat: add Assets-import-attributes module for node/ssr env May 14, 2025
@ilhan007 ilhan007 requested a review from pskelin May 14, 2025 15:47
@nnaydenow
Copy link
Contributor

I think that we have to add file to fiori package as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants