$ cnpm install @nuxt/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
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 un as devDependency
:
yarn add --dev @nuxt/un
# or
npm i -D @nuxt/un
You can import modules from @nuxt/un/runtime/
import { env, nodeless } from '@nuxt/un'
const { alias, inject } = env(nodeless, {
alias: {
// custom aliases
}
})
http
net
stream
MIT
Copyright 2014 - 2017 © taobao.org |