Skip to content

Commit a528b22

Browse files
authored
Create publishing.md
1 parent bb319a5 commit a528b22

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

design/publishing.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This design document focuses on the following -
2+
1. Separate entry points for node and browser.
3+
2. Specifying the browser field in package.json
4+
3. Changes in the bundling process
5+
6+
Terms -
7+
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+
10+
package.json fields -
11+
* main - The main field is a module ID that is the primary entry point to your program. Points to the CJS modules.
12+
13+
* module - The module field is not an official npm feature but a common convention among bundlers to designate how to import an ESM version of a library. Points to the ES modules.
14+
15+
* browser - If your module is meant to be used client-side the browser field should be used instead of the main field.
16+
17+
Current set up -
18+
19+
1.
20+
TypeScript Source Code
21+
/ \
22+
Transpiles into JavaScript
23+
/ \
24+
CJS module ES modules
25+
2. main - `lib/src/index.js`
26+
module - `lib/src/es/index.js`
27+
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.
30+
* graph-es-sdk.js - ES bundled file.
31+
4. Entry point for rollup - `lib/es/browser/index.js`.
32+
5.
33+
34+
Upcoming changes -
35+
36+
1. Bundle the authproviders serately as they are optional.

0 commit comments

Comments
 (0)