bs5-utils icon indicating copy to clipboard operation
bs5-utils copied to clipboard

Error in browser

Open mila76 opened this issue 3 years ago • 4 comments

I use bs5-utils with the dist/js in a script tag

With the last version i have some problem with other library... this error popup loading a library after bs5-utils: module is not defined

With the previous version no problem. I can also fix this error putting bs5 tag last

mila76 avatar Jan 15 '22 19:01 mila76

@mila76

Can you please provide a reproduciable example because I've got it working without any issues here using the latest version: https://jsfiddle.net/cr0dez8q/

Script47 avatar Jan 16 '22 00:01 Script47

https://jsfiddle.net/o37kyac2/

pasted another library (tingle js) You can see the error in browser console

I think the problem is exports = {} in your library (webpack doing i assume)

mila76 avatar Jan 16 '22 09:01 mila76

Same issue when mixing this e.g. with nprogress.

It is fairly common to see code like this:

  if (typeof define === 'function' && define.amd) {
    define(factory);
  } else if (typeof exports === 'object') {
    module.exports = factory();
  } else {
    root.NProgress = factory();
  }

The presense of exports object, unfortunately, confuses it.

In this instance I could just reverse the order in which scripts are loaded, but regardless, cluttering the global exports var is definitely not a good thing.

nirvana-msu avatar Jul 05 '22 01:07 nirvana-msu

Same issue when including dist/js in a script tag along with with Pace.js https://github.com/CodeByZach/pace/issues/541

btraas avatar Nov 04 '22 17:11 btraas