Publishing in the JavaScript Ecosystem & Keeping Users Happy
The contents here is created from the official CascadiaJS Page
Overview
- name: Trivikram Kamat
- Speaker Page
Abstract
This talk will cover how your JavaScript package can support various runtimes and module formats, while keeping bundle/publish/install sizes in check and providing types/sources/source-maps.
Notes
(starting notes a little late)
-
bunch of criteria and it depends.
-
Module formats
- defines a module
-
Of course we should only support ESM.
-
Package has a carbon footprint depending on the size of the bundle.
-
Reduce publish size
- only publish required files with
package.json
'sfiles
field.
- only publish required files with
-
DefinitelyTyped will reduce package size. lol
-
TypeScript dist tags.
- You can have a @variant (Private) on a package name
@scope/<name>@variant
when exporting a package.
- You can have a @variant (Private) on a package name
-
Provide ESM version of your package.
-
Smaller modules
-
Tree-shaking.
-
Publishing a JS package:
- Small package size
- Observability with Open Trace (types.d.ts)
- Support ESM and Common JS with multiple packages.
kevin
Notes by-
speaker
- three-vikram
- #CascadiaJS (Private)
-
publishing
- browsers:
- servers: nodejs, deno, etc
- ns native: react, native, flutter
- module formats: cjs, esm
- sizes: publish, install, bundle
- types: flow, typescript
- debugging: source, sourcemap
- observability: open*, etc
-
criteria to consider
- depends
-
publishing criteria
- why, how, what
-
browser, why?
- script on browser
- isn't js support fragmented on browser
- yes but
- IE retired in 05/15/2022
- safari competitive? (lol)
-
server, why
- nodejs most popular
- deno
- fragmentation?
- web interoperable runtimes community group
-
deno, how?
- experimental npm support
-
bun, how?
- compatible?
-
js native, why?
- write javascript, ui framework create native apps
- have limitation
- perf tradeoffs, has become better
-
module formats, why?
- ...
-
module formats, how?
- supporting cjs/esm, you can use esm module wrapper
gen-esm-wrapper
-
sizes (why)?
-
publish: pkg being published
-
install:
node_modules
on install -
bundle: bundled artifact
-
why important?
- load times
- constrained environments (eg. serverless)
-
-
reducing size
- publish:
- remove unecessary things in package.json
- eg. move types to definitely typed
- remove unecessary things in package.json
- install
- minimal dependencies
- provide variant of pkg for resource-constraint environment
- bundle
- tree-shakeable code
- named exports
- publish esm version of pkg
- remove side effects
- tree-shakeable code
- publish:
-
types (why)
- ts popular
- ecmascript proposal for type annotation
-
debugging (why)
- you have a language that compiles to js
- source maps for debug
- you have a language that compiles to js
-
observability (why)
- help measure state of app
-
observability (how)
- add opentelemetry package
-
conclusion
- brwoser: support modern browser
- server: nodejs with deno support
- js native: depends
- module formats: cjs+esm or esm only
- sizes: aim small
- types: publish typescript types
- debuggign: provide sources
- observability: add hook to open telemetry
Children
Tags
Backlinks