-
Notifications
You must be signed in to change notification settings - Fork 6
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-enable dynamic loading of i18n modules & put our bundle on a diet #76
Open
2 of 4 tasks
sergei-maertens opened this issue
Sep 27, 2021
· 2 comments
· Fixed by #777, open-formulieren/open-forms#5028 or #781
Open
2 of 4 tasks
Re-enable dynamic loading of i18n modules & put our bundle on a diet #76
sergei-maertens opened this issue
Sep 27, 2021
· 2 comments
· Fixed by #777, open-formulieren/open-forms#5028 or #781
Labels
Comments
sergei-maertens
added a commit
that referenced
this issue
Sep 27, 2021
This comment has been minimized.
This comment has been minimized.
We can't do it with Vite and UMD build - everything is inlined there, but going the ESM route is probably viable! And there's a graceful fallback option. |
sergei-maertens
changed the title
Re-enable dynamic loading of i18n modules
Re-enable dynamic loading of i18n modules & put our bundle on a diet
Jan 15, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 21, 2025
This was referenced Jan 21, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 21, 2025
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Jan 21, 2025
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Jan 21, 2025
… if the browser supports it Using module type scripts makes it possible to opt into the benefits of bundle splitting where only code is loaded that will actually be used. This sets up a wrapper entrypoint/script gated behind the type=module feature of browsers so it's not executed by browsers that don't natively support modules yet. An extra advantage is that we can pass all the necessary configuration via data attributes and process them in our script, meaning we don't need inline scripts and CSP nonces anymore for this. Finally, the SDK ESM module is added to the preload list since we are guaranteed that we'll need it, and we avoid a waterfall when loading the entrypoint and then dynamically importing the SDK bundle - those can be fetched in parallel.
10 tasks
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Jan 22, 2025
… if the browser supports it Using module type scripts makes it possible to opt into the benefits of bundle splitting where only code is loaded that will actually be used. This sets up a wrapper entrypoint/script gated behind the type=module feature of browsers so it's not executed by browsers that don't natively support modules yet. An extra advantage is that we can pass all the necessary configuration via data attributes and process them in our script, meaning we don't need inline scripts and CSP nonces anymore for this. Finally, the SDK ESM module is added to the preload list since we are guaranteed that we'll need it, and we avoid a waterfall when loading the entrypoint and then dynamically importing the SDK bundle - those can be fetched in parallel.
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Jan 22, 2025
… if the browser supports it Using module type scripts makes it possible to opt into the benefits of bundle splitting where only code is loaded that will actually be used. This sets up a wrapper entrypoint/script gated behind the type=module feature of browsers so it's not executed by browsers that don't natively support modules yet. An extra advantage is that we can pass all the necessary configuration via data attributes and process them in our script, meaning we don't need inline scripts and CSP nonces anymore for this. Finally, the SDK ESM module is added to the preload list since we are guaranteed that we'll need it, and we avoid a waterfall when loading the entrypoint and then dynamically importing the SDK bundle - those can be fetched in parallel.
sergei-maertens
added a commit
that referenced
this issue
Jan 22, 2025
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Jan 22, 2025
sergei-maertens
added a commit
to open-formulieren/open-forms
that referenced
this issue
Jan 22, 2025
… if the browser supports it Using module type scripts makes it possible to opt into the benefits of bundle splitting where only code is loaded that will actually be used. This sets up a wrapper entrypoint/script gated behind the type=module feature of browsers so it's not executed by browsers that don't natively support modules yet. An extra advantage is that we can pass all the necessary configuration via data attributes and process them in our script, meaning we don't need inline scripts and CSP nonces anymore for this. Finally, the SDK ESM module is added to the preload list since we are guaranteed that we'll need it, and we avoid a waterfall when loading the entrypoint and then dynamically importing the SDK bundle - those can be fetched in parallel.
sergei-maertens
added a commit
that referenced
this issue
Jan 22, 2025
This should make the main bundle smaller and ensure we only fetch the translations that will actually be used.
Merged
sergei-maertens
added a commit
that referenced
this issue
Jan 22, 2025
This should make the main bundle smaller and ensure we only fetch the translations that will actually be used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The webpack config causes these to be loaded from a relative path to the page where the SDK is embedded, rather than relative to the
sdk.js
module.A quick fix right now is to always bundle these files instead of loading them dynamically, but this will make the bundle fatter as we add more translations.
The text was updated successfully, but these errors were encountered: