global is not defined when exporting as umd build #19131
Unanswered
shashank-brightness
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I checked similar thread elsewhere and tried like that but still i am not getting proper resolution.
I have lets say this index.js file which is the entry point and exports
prepareEditorHTML
function.Now i have configured vite to take build library and ability to access my library under name MyLib like this. Also, i have defined some packages as global to be able to use them using window level whenever required but already available.
and i expected to become my exported function
prepareEditorHTML
available under window.MyLib.prepareEditorHTML however MyLib is just empty object and nothing is attached to it. Weird!!!Also when i checked in resulting index.umd.js it compiles to something like
(global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.MyLib= {}, global.persist, global.bootstrap.Dropdown, global.bootstrap.Tab, global.fabric, global.bootstrap.Tooltip, global.bootstrap.Modal));
when i was using webpack, it was automatically obtained under window level but now i am not getting this. How to fix these both issues?
Beta Was this translation helpful? Give feedback.
All reactions