Skip to content

Commit

Permalink
Merge pull request #147 from FriedRiceNoodles/fix/autoloader
Browse files Browse the repository at this point in the history
fix(autoloader): make autoloader covers b-message
  • Loading branch information
FriedRiceNoodles authored Jun 7, 2024
2 parents 6bdc989 + 94c54f0 commit aedd67e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/wet-teachers-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@banana-ui/banana': patch
'@banana-ui/react': patch
---

Make autoloader covers b-message
8 changes: 8 additions & 0 deletions packages/banana/src/banana-autoloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ void discover(document.body);

// Listen for new undefined elements
observer.observe(document.documentElement, { subtree: true, childList: true });

// BMessage is a special case because it's often used by window.BMessage methods but not directly in the DOM
// If it's not defined, import it directly
if (!customElements.get('b-message')) {
// import the module
const path = getBasePath('message/index.js');
void import(path);
}

0 comments on commit aedd67e

Please sign in to comment.