lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.31k stars 70 forks source link

"jquery" not exists in the running context #66

Closed kitety closed 1 year ago

kitety commented 1 year ago

When I import "jquery" from package.json, it is running well in the dev environment. But it is an error after build after I set externalGlobals externalGlobals: { jquery: cdn.jsdelivr("jquery"), }, Its build result is this:

  (() => {
    main();
  })();

})(jquery);

Because jquery is not in the window, but jQuery is in. I do not want to edit my build file every time after the build. image

lisonge commented 1 year ago

the export name is jQuery instead of jquery

externalGlobals: { jquery: cdn.jsdelivr("jQuery"), },

jquery : esm package name

jQuery : iife/umd export name