From a528b228da07ddd71d4e7779437651e653910c6c Mon Sep 17 00:00:00 2001 From: Nikitha Chettiar Date: Tue, 23 Feb 2021 00:36:29 -0800 Subject: [PATCH 1/4] Create publishing.md --- design/publishing.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 design/publishing.md diff --git a/design/publishing.md b/design/publishing.md new file mode 100644 index 000000000..e4d145d1a --- /dev/null +++ b/design/publishing.md @@ -0,0 +1,36 @@ +This design document focuses on the following - +1. Separate entry points for node and browser. +2. Specifying the browser field in package.json +3. Changes in the bundling process + +Terms - + +bundler - Module bundlers are tools frontend developers used to bundle JavaScript modules into a single JavaScript files that can be executed in the browser. + +package.json fields - +* main - The main field is a module ID that is the primary entry point to your program. Points to the CJS modules. + +* 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. + +* browser - If your module is meant to be used client-side the browser field should be used instead of the main field. + +Current set up - + +1. + TypeScript Source Code + / \ + Transpiles into JavaScript + / \ + CJS module ES modules +2. main - `lib/src/index.js` + module - `lib/src/es/index.js` + +3. Rollup bundling output +* graph-js-sdk.js - IIFE bundled file. This file can be directly used in the browser with a `