Skip to content
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

Error in use by requirejs #121

Open
randyou opened this issue Oct 19, 2018 · 0 comments
Open

Error in use by requirejs #121

randyou opened this issue Oct 19, 2018 · 0 comments

Comments

@randyou
Copy link

randyou commented Oct 19, 2018

https://github.com/SheetJS/js-xlsx/tree/master/demos/requirejs

require(["xlsx"], function(XLSX) {
	/* use XLSX here */
});

XLSX is not XLSX which is JSZip !

then fix it in xlsx.full.min.js like below

!function(e) {
    if ("object" == typeof exports && "undefined" != typeof module)
        module.exports = e();
    else if ("function" == typeof define && define.amd) {
       //fix here
        window.JSZip = e();
        define([], function() {
            return window.XLSX;
        });
    } else {
        var f;
        "undefined" != typeof window ? f = window : "undefined" != typeof global ? f = global : "undefined" != typeof self && (f = self),
        f.JSZip = e()
    }
}
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant