You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
##### This design document focuses on the following -
2
2
1. Separate entry points for node and browser.
3
3
2. Specifying the browser field in package.json
4
4
3. Changes in the bundling process
5
5
6
-
Terms -
6
+
##### Terms -
7
7
8
8
bundler - Module bundlers are tools frontend developers used to bundle JavaScript modules into a single JavaScript files that can be executed in the browser.
9
9
@@ -14,7 +14,7 @@ package.json fields -
14
14
15
15
* browser - If your module is meant to be used client-side the browser field should be used instead of the main field.
16
16
17
-
Current set up -
17
+
##### Current set up -
18
18
19
19
1.
20
20
TypeScript Source Code
@@ -26,11 +26,30 @@ Current set up -
26
26
module - `lib/src/es/index.js`
27
27
28
28
3. Rollup bundling output
29
-
* graph-js-sdk.js - IIFE bundled file. This file can be directly used in the browser with a `<script>` tag.
29
+
* graph-js-sdk.js - IIFE bundled minified file. This file can be directly used in the browser with a `<script>` tag.
30
30
* graph-es-sdk.js - ES bundled file.
31
31
4. Entry point for rollup - `lib/es/browser/index.js`.
32
-
5.
33
32
34
-
Upcoming changes -
35
-
36
-
1. Bundle the authproviders serately as they are optional.
33
+
##### Difference between src/index.js and src/browser/index.js
34
+
1. src/browser/index.js does not export 'RedirectHandler' and 'RedirectHandlerOptions'. Redirection is handled by the browser.
35
+
2. src/index.js exports-> src/ImplicitMsalProvider and src/browser/index.js exports src/browser/ImplicitMsalProvider.
36
+
3. Only difference in the implementation is that src/browser/ImplicitMsalProvider does not import or require 'msal' dependency.
37
+
38
+
Presently, some browser applications importing the npm package like Graph Explorer use lib/es/src/index.js and not the browser/index.js.
39
+
40
+
##### Upcoming changes -
41
+
42
+
1. Use the browser field for the following -
43
+
44
+
* We currently have two entry files, src/index.ts and src/browser/index.ts.
45
+
Use the browser field to indicate the browser entry point.
Currently, we have the main and "module field in the package.json. This will remain the same.
50
+
2. Better way to handle environment specific implementation. For example, using the browser field we can indicate as follows -
51
+
"browser":
52
+
{ "stream": "stream-browserify" }
53
+
3. Maintain a separate entry point for the rollup process.
54
+
4. Continue rolling up the src/browser/ImplicitMsalProvider as we currently do and not introduce breaking changes here as we are planning to deprecate this.
55
+
5. Bundle the authproviders separately as they are optional.
0 commit comments