1.0.1 • Published 11 months ago

esm-package-browser-server v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

esm-package-browser-server

Example ESM package which exports both browser and server modules and isomorphic JavaScript code which can run in browser and/or server.

Usage

For browser:

import { shared, browser } from "esm-package-browser-server";
console.log(shared('Example'));
console.log(browser('Example'));

For server:

import { shared, server } from "esm-package-browser-server";
console.log(shared('Example'));
console.log(server('Example'));

Shared function should be able to be run both browser/server, but the the other code not accessible unless on correct platform.

How it works

Using conditional exports:

"exports": {
  "node": "./src/server.js",
  "default": "./src/browser.js"
},

Node process will use ./src/server.js others will fallback to ./src/browser.js

Contact

For more information please contact kmturley

1.0.1

11 months ago

1.0.0

11 months ago