@nuxt/un
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

un

un

Once upon a time, one server was all needed to have a website

And then SPAs1 moved server code to browser

And then SSR2 moved browser code to server

And then Workers3 moved browser/server code to workers

Workers are neither NodeJS with process or Browser with window

Yet expected to run code that had to work both of them :}

[1] Single Page Applications [2] Server Side Rendering [3] https://workers.cloudflare.com

What is un?

un is a collection of modules, polyfills and presets that work perfectly with any Javascript environemnt including Browsers, Workers, NodeJS or pure JavaScript.

You still need a bundler like rollup.js and un will disapear as soon as is bundled.

The goal is that final bundle works consistent regardless of running context yet not adding excessive polyfills.

Install

Install un as devDependency:

yarn add --dev @nuxt/un
# or
npm i -D @nuxt/un

You can import modules from @nuxt/un/runtime/

Env

import { env, nodeless } from '@nuxt/un'

const { alias, inject } = env(nodeless, {
  alias: {
    // custom aliases
  }
})

Presets

polyfills

NodeJS

http

net

stream

Mocks

Packages

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @nuxt/un

Weekly Downloads

7

Version

0.1.1

License

MIT

Unpacked Size

27.9 kB

Total Files

30

Last publish

Collaborators

  • atinux
  • pi0
  • antfu
  • danielroe
  • nuxtbot