extract rendering part of nuxt to produce lightweight bundle for cloud computing environments
Why
The nuxt + serverless + AWS lambda combination could be really great, but serverless do not support tree-shaking and just exclude devDependencies. As a result bundle produced with nuxt are really large (30-46 MB), way to close to AWS lambda deployment package size limit (50 MB).
To solve the problem this package extract just the nuxt renderer from your installed nuxt version and produce a drop-in place replacement package for nuxt.
Install
npm i --save-dev nuxt@VERSION
npm i --save-dev @ezy/nuxt-renderer-extractor
API
@ezy/nuxt-renderer-extractor
aka ezy-nre
have a small API with only 2 commands:
-
npx ezy-nre list
to list all generated versions of@ezy/nuxt-renderer
-
npx ezy-nre generate
to generate a version of@ezy/nuxt-renderer
matching yournuxt
package
Usage
npx ezy-nre generate
npm i node_modules/@ezy/nuxt-renderer-extractor/generated/VERSION
now your can replace nuxt imports with your shinny new renderer.
// import { Nuxt } from 'nuxt'
import { Nuxt } from '@ezy/nuxt-renderer';