-
Notifications
You must be signed in to change notification settings - Fork 339
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
Use a default export for UMD module #181
Use a default export for UMD module #181
Conversation
c51db6c
to
c2bac35
Compare
Going to add some documentation for this one, converting this to a draft. |
c2bac35
to
6641b5e
Compare
So for users using the UMD version (either globals, or AMD) the following migration steps would apply: GlobalsThe global Before <script src="jwt-decode.js"></script>
<script>
const token = "eyJhsw5c";
const decoded = jwt_decode(token);
</script> After <script src="jwt-decode.js"></script>
<script>
const token = "eyJhsw5c";
const decoded = jwtDecode(token);
</script> AMDThe AMD module name has been renamed from Before <script src="jwt-decode.js"></script>
<script>
define(["jwt_decode"], (jwtDecode) => {
const token = "eyJhsw5c";
const decoded = jwtDecode(token);
});
</script> After <script src="jwt-decode.js"></script>
<script>
define(["jwt-decode"], (jwtDecode) => {
const token = "eyJhsw5c";
const decoded = jwtDecode(token);
});
</script> @frederikprijck do you feel these changes make sense? Alternatively, we can keep things as they were before for maximum backwards compatibility. Can go either way as far as I am concerned. |
I would stick to what we had for AMD, changing UMD makes sense to me. I feel its unneccesary to have amd users have to make that change when it's working fine today, that wasn't the intention of the new major to begin with. |
6641b5e
to
937222e
Compare
Yeah, I have to agree with that. I've reverted this back so that it should be 1-1 backwards compatible with what was before.
Not quite sure what you mean here. Just to clarify AMD is a sub-set of UMD, UMD attempts to make AMD and CommonJS interoperable with each other. What exactly do you mean by "changing UMD makes sense to me"? Are you perhaps referring to the global? |
937222e
to
eee8d4e
Compare
Creates an alias for
jwtDecode
as the default export for UMD modules. Since users of the UMD module are very unlikely to migrate this will give them maximum compatibility with previous versions.