-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mOxie namespace gone? v1.5.3 #171
Comments
Anyone else had this or do I just bring in plupload and moxie can no longer be run standalone? |
You could include those files directly. Or simply use Maybe I should make |
Let me try moxie I thought I had tried that and it hadn't worked either. Without the plupload scripts |
|
@jayarjo if I do the following I'm getting undefined for moxie as well. require(['/moxie.min.js'],function() {
console.log(moxie); //undefined
}); require(['/moxie.min.js'],function(moxie) {
console.log(moxie); //undefined
}); The moxie lib is being imported. I don't see any moxie in window namespace either. |
if I just add the following in a blank html template <script src="lib/moxie/js/moxie.min.js"></script> Without using require within a html file then moxie namespace is available.
Thanks |
You do not need to get fancy there. Simple: require(['moxie'], function(moxie) {
console.log(moxie);
}); should do the thing. Or even: import moxie from 'moxie'; if your environment is ready. |
That's what I thought but if I strip everything right down and do this as a basic example/test - //this is shown in the html head after the page loads -
<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="lib/moxie/js/moxie.min.js" src="lib/moxie/js/moxie.min.js"></script> This is the test I'm using stripped down: <!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
</head>
<body>
<script src="../../../lib/requirejs/require.min.js"></script>
<script>
require(['lib/moxie/js/moxie.min.js'], function(moxie) {
console.log(moxie);
});
</script>
</body>
</html> window.moxie also does not exist? |
Sorry I had an impression that you were using Webpack. I've never used RequireJS, so can't help you there. It might be that mOxie is not even compatible with it, unless it auto-magically follows the same conventions.
|
I think what you were lacking was proper config. This worked fine for example: <!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
<script>
require.config({
baseUrl: "lib",
paths: {
"moxie": "mOxie/bin/js/moxie.min"
}
});
require(['moxie'], function(moxie) {
console.log(moxie);
});
</script>
</body>
</html> Be sure to adjust config to your local paths. |
ahh ;) - it used to work - as I used it with requirejs in v1.2.1 - but when I upgraded to latest release it broke. |
It might be that RequireJS was simply loading the script. mOxie, just as plupload were not properly encapsulated, so should have leaked namespaces to global environment. We had multiple complaints about this, so we "fixed" it. Try the config above, it worked for me. |
Yup - the above worked for me... Strange.. ie Failed path entry require(['moxie/js/moxie.min'], function(moxie) {
console.log(moxie);
}); Worked - config name entry require(['moxie'], function(moxie) {
console.log(moxie);
}); |
Internally the module is defined as |
Tried to use https://github.com/moxiecode/moxie/blob/master/src/javascript/o.js to bring int he namespace but getting the following error
o.js:23 Uncaught TypeError: Cannot read property 'core' of undefined
at o.js:23
Simple example - also tried shim within config requirejs.
Whats the new approach of using mOxie without plupload?
The text was updated successfully, but these errors were encountered: