Skip to content
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

Oskari 3.0 bundle loader #2791

Merged
merged 4 commits into from
Feb 19, 2025
Merged

Oskari 3.0 bundle loader #2791

merged 4 commits into from
Feb 19, 2025

Conversation

ZakarFin
Copy link
Member

The idea is that we can get rid of packages folder and simplify the bundle.js files that were located in the packages-folder (which makes things easier to document etc) .

The included bundles/admin/admin/index.js is an example of what the bundle.js replacement could be. In the applications main.js this would change the import from:

import 'oskari-loader!oskari-frontend/packages/admin/bundle/admin/bundle.js';

to:

import 'oskari-bundle!oskari-frontend/bundles/admin/admin';

This makes everything simpler by removing lot of the copy/pasted parts of bundle.js and only leaving the essentials:

  • what happens when the application wants to use a bundle with given id. This is done with:
Oskari.bundle('myBundle', () => /* return a bundle instance for bundle "myBundle" that can be started */ );

Everything else remains the same (the instance start() function is called and configuration is injected). The bundle-loader figures out the localization files for the bundle by searching files in the resources/locale/ folder next to the index.js. This way we only need to add the files and not reference them in the index.js. If we do need to manually setup locales, we could add something like locales.json next to index.js that can refer to files that are not in the default localization folder.

@ZakarFin ZakarFin added this to the 3.0.0 milestone Feb 18, 2025
@ZakarFin
Copy link
Member Author

Note! The new loader doesn't support the expose-functionality that is used on some bundles.

@ZakarFin ZakarFin merged commit acf94f9 into oskariorg:develop Feb 19, 2025
3 checks passed
@ZakarFin ZakarFin deleted the bundle-loader branch February 19, 2025 13:06
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.

1 participant