plupload icon indicating copy to clipboard operation
plupload copied to clipboard

mOxie is undefined

Open antoniobrandao opened this issue 10 years ago • 23 comments

Hi, I'm trying to use plupload (v1.2.1) in a CommonJS / Browserify environment

var plupload = require('libs/plupload/js/plupload.full.min');

But when that require runs I always get mOxie is undefined:

plupload.full.min.js:28 Uncaught ReferenceError: mOxie is not defined

Does plupload strictly depend on the mOxie module?

Im not sure this is related to being run in a CommonJS environment. I've looked into the source of plupload.dev.js and moxie.js and they don't seem to use the UMD pattern. Are they compatible with CommonJS?

antoniobrandao avatar Jan 06 '16 12:01 antoniobrandao

Plupload v1.2.1 doesn't depend on mOxie.

jayarjo avatar Jan 06 '16 18:01 jayarjo

Hi, I ran into the same issue. Patched it up by adding this between mOxie and plupload:

var mOxie = exports.mOxie;

And at the end of the minified script, I added this:

module.exports = plupload;

OriginalEXE avatar Feb 13 '16 23:02 OriginalEXE

@OriginalEXE Great stuff. What do mean exactly by "between mOxie and plupload" ?

antoniobrandao avatar Feb 15 '16 14:02 antoniobrandao

I meant in this file: https://raw.githubusercontent.com/moxiecode/plupload/master/js/plupload.full.min.js

Here is how my file looks now: http://pastebin.com/raw/4BSePwA9

OriginalEXE avatar Feb 15 '16 14:02 OriginalEXE

@OriginalEXE nice quick fix, thanks for sharing.

antoniobrandao avatar Feb 16 '16 23:02 antoniobrandao

Thanks @OriginalEXE. It would be great if this was worked into the full package somehow. Would if I could... :)

wdmtech avatar Mar 14 '16 10:03 wdmtech

@jayarjo How do you suggest that one requires plupload? I'm still having this issue when requiring plupload.full.min.js (and any other built file for that matter).

The fix above works for me, but it means I have to manually intervene each time I build.

image

wdmtech avatar Apr 07 '16 18:04 wdmtech

What do you mean each time you build, how often do you build plupload?

OriginalEXE avatar Apr 07 '16 18:04 OriginalEXE

For instance, when I do npm install, which will eventually automated as part of my build process. I'm more talking about building my project, rather than plupload (I am using the dist files currently)

wdmtech avatar Apr 07 '16 18:04 wdmtech

Oh, got it.

Yeah it's a pain in the ass, for now I would recommend just requiring a local version instead of relying on the npm-one, until they add proper support for this.

OriginalEXE avatar Apr 07 '16 18:04 OriginalEXE

Sounds like a plan, thanks again @OriginalEXE :smiley:

wdmtech avatar Apr 07 '16 18:04 wdmtech

Instead of using a local copy you can also publish your own module on NPM, with the suggested fix.

antoniobrandao avatar Apr 07 '16 19:04 antoniobrandao

I am still have this issue. my plupupload version is 2.1.2.

yonycat avatar May 27 '16 06:05 yonycat

this issue cured on chrome at version 50

yonycat avatar May 27 '16 06:05 yonycat

I am still have this issue. my plupupload version is 2.1.1. image

simonqian avatar Jul 06 '16 02:07 simonqian

my plupupload version is 2.1.1 I include moxie.js and plupload.dev.js.

require 'plupload/js/moxie.js' require 'plupload/js/plupload.dev.js'

but still have this issue. image

simonqian avatar Jul 06 '16 03:07 simonqian

@simonqian var m = require('./vendors/upload/moxie'); window.moxie = m.moxie; window.mOxie = m.mOxie; require('./vendors/plupload.dev');

ksprider avatar Jul 12 '16 11:07 ksprider

@ksprider This was very helpful to me, thank you!

simonqian avatar Jul 15 '16 02:07 simonqian

great !!

suhaotian avatar Jul 22 '16 05:07 suhaotian

Floor 3rd is right, that's awesome

Ancisuce avatar Oct 11 '16 10:10 Ancisuce