GithubHelp home page GithubHelp logo

Comments (16)

DibranMulder avatar DibranMulder commented on June 14, 2024 4

This guy forked the repo and added all major module implementations, take a look at:
https://github.com/malekpour/microsoft-authentication-library-for-js

from microsoft-authentication-library-for-js.

cesarvarela avatar cesarvarela commented on June 14, 2024 4

I'm not sure why this isn't the default behavior.

from microsoft-authentication-library-for-js.

firewave-remo avatar firewave-remo commented on June 14, 2024 1

Any news on this?

from microsoft-authentication-library-for-js.

pdimitratos avatar pdimitratos commented on June 14, 2024 1

To my understanding, most es6 features should be available in IE11 with one or more polyfills (such as Babel). You already do this to support promises.

It's strange to me that the new version of the JavaScript auth library requires jumping through more hoops to be used with modern JavaScript frameworks than the ADAL v1 library does.

Is it at least possible to register a second npm package that's built for ES6 by default?

from microsoft-authentication-library-for-js.

maggiepint avatar maggiepint commented on June 14, 2024 1

from microsoft-authentication-library-for-js.

rohitnarula7176 avatar rohitnarula7176 commented on June 14, 2024 1

Feature is now added to dev and will be part of our next release early next week. Closing this issue for now. Please reopen if you still face issues.

from microsoft-authentication-library-for-js.

jmprieur avatar jmprieur commented on June 14, 2024

@TulyOpt : if you clone the repo and change in es5 to es6 here: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/master/tsconfig.base.json#L7, you would generate msal for es6. Would that work for you?

from microsoft-authentication-library-for-js.

TulyOpt avatar TulyOpt commented on June 14, 2024

Hi,

thanks for your answer, i will try this.

from microsoft-authentication-library-for-js.

jmprieur avatar jmprieur commented on June 14, 2024

from microsoft-authentication-library-for-js.

jmprieur avatar jmprieur commented on June 14, 2024

I believe that es5 is needed so that msal.js can be used with IE: See https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Using-msal.js-with-Internet-Explorer.
Do you have ways to run es6 JavaScript with IE?

from microsoft-authentication-library-for-js.

maggiepint avatar maggiepint commented on June 14, 2024

Modules don't have the same polyfill-ability as other ESNext features. That said, it should be possible with the right npm configuration to publish both the transpiled ESNext code and the built files. This is what we do with momentjs. All that being said, I'm not sure how that interacts with the typescript here - that's not a space I have a lot of expertise in. I think that @DanielRosenwasser, @bterlson, or @TheLarkInn would be able to clarify on that if they're available.

Happy to contribute back the ESNext changes if you're comfortable with that.

from microsoft-authentication-library-for-js.

bterlson avatar bterlson commented on June 14, 2024

TypeScript will compile standard ES6 modules into a format consumable by IE11. There are other tools that can do this as well. I am also willing to help update this if I am needed.

from microsoft-authentication-library-for-js.

akorchev avatar akorchev commented on June 14, 2024

There is more than one way to deal with this problem:

  1. Set the module compiler option to umd instead of amd. TypeScript will produce a universal module which should work both with Node and browsers.
  2. Have another tsconfig which has module set to commonjs. Ship both amd and commonjs files to NPM. Configure package.json to point to the commonjs version: "main": "./out/msal.common.js",

from microsoft-authentication-library-for-js.

rohitnarula7176 avatar rohitnarula7176 commented on June 14, 2024

@TulyOpt @jmprieur @maggiepint @akorchev @bterlson @pdimitratos @cesarvarela @DibranMulder @VSDekar I have generated both commonjs and es-6 modules for msal in this branch as you can see in the "lib-commonjs" and "lib-es6" folder. In addition to that, we will ship a UMD bundle that will expose "Msal" as the global variable in the browser located in the 'dist" folder. Since it is not shipped to npm yet, you cannot just use npm install msal and get these yet. For testing though, you can generate a folder named msal in the node_modules folder of your app and clone the repo inside it. You will then be able to use statements like import {UserAgentApplication} from "msal". I have created a test app to test this using what I explained above: Please refer to https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/rohitnarula7176/modules/devApps/ModuleSample/src/components/index.tsx. Can you all please use it and confirm if that solves your issue.

from microsoft-authentication-library-for-js.

rohitnarula7176 avatar rohitnarula7176 commented on June 14, 2024

@TulyOpt @jmprieur @maggiepint @akorchev @bterlson @pdimitratos @cesarvarela @DibranMulder @VSDekar I have also published a beta version on npm which you can install using npm install [email protected]. You would then be able to import msal using es-6 and commonjs syntax. We will release an official version after testing.

from microsoft-authentication-library-for-js.

RobertoPrevato avatar RobertoPrevato commented on June 14, 2024

@jmprieur, just a comment about your previous sentence and IE support. It's possible to write es5 code that works fine in every situation: direct file download (using script element), module export and AMD definitions. This used to be a quite common technique for libraries. Something like:

;(function(factory) {
  if (typeof module !== "undefined" && module.exports) {
    // Node/CommonJS
    module.exports = factory(this);
  } else if (typeof define === "function" && define.amd) {
    // AMD
    var global=this;
    define("LIBRARY_NAME", function(){ return factory(global);});
  } else {
    // Browser globals
    this.LIBRARY_NAME = factory(this);
  }
}(function(global) {
  var LIBRARY_NAME = {};

  return LIBRARY_NAME;
}));

This would have saved some headaches. I hit this wall when trying to use msal.js in a Vue.js project, now I am going to try with last update mentioned in last comment.

from microsoft-authentication-library-for-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.