rubystarashe / nuxt-vuex-localstorage

MIT License
161 stars 18 forks source link

Footprint of this module is really huge #32

Open jlagneau opened 3 years ago

jlagneau commented 3 years ago

When I create a base nuxt app, just adding this module makes the build really huge. The net increase is about 1MB in stat size with a lot of libs (browserify, elliptic being the main culprits) and it end up being larger than Nuxt all its dependencies combined. Is there a way to reduce this module footprint? No amount of splitting seems to reduce that as I use stored data on pretty much every pages.

Here an example:

create-nuxt-app v3.6.0
✨  Generating Nuxt.js project in test
? Project name: test
? Programming language: JavaScript
? Package manager: Yarn
? UI framework: None
? Nuxt.js modules: None
? Linting tools: None
? Testing framework: None
? Rendering mode: Single Page App
? Deployment target: Static (Static/Jamstack hosting)
? Development tools: None
$ nuxt build -a
# ...
Asset                                Size  Chunks                         Chunk Names
../server/client.manifest.json   8.06 KiB          [emitted]              
LICENSES                        390 bytes          [emitted]              
app.d8cdaa7.js                   53.6 KiB       0  [emitted] [immutable]  app
commons/app.36dabdf.js            195 KiB       1  [emitted] [immutable]  commons/app
components/logo.db6dd2f.js       1.43 KiB       2  [emitted] [immutable]  components/logo
pages/index.81a979a.js           3.02 KiB    3, 2  [emitted] [immutable]  pages/index
runtime.1d766ff.js               2.35 KiB       4  [emitted] [immutable]  runtime
+ 1 hidden asset
Entrypoint app = runtime.1d766ff.js commons/app.36dabdf.js app.d8cdaa7.js

image

When I add this module and rebuid:

// nuxt.config.js file
export default {
  modules: ['nuxt-vuex-localstorage'],
}
$ nuxt build -a
# ...
Asset                                Size  Chunks                                Chunk Names
../server/client.manifest.json   15.3 KiB          [emitted]
15db271.js                       3.02 KiB    3, 2  [emitted] [immutable]         pages/index
15e8209.js                       46.3 KiB       0  [emitted] [immutable]         app
88b6ddb.js                       1.43 KiB       2  [emitted] [immutable]         components/logo
LICENSES                        701 bytes          [emitted]
a7f9fc1.js                        2.3 KiB       4  [emitted] [immutable]         runtime
bc773f4.js                        465 KiB       5  [emitted] [immutable]  [big]  vendors/app
c44a445.js                        209 KiB       1  [emitted] [immutable]         commons/app
+ 1 hidden asset
Entrypoint app = a7f9fc1.js c44a445.js bc773f4.js 15e8209.js

image

Pranavraut033 commented 2 years ago

+1