Reputation: 383
I am setting up a website and come cross the problem that the size of vendor.js is as big as up to 700KB.
I start running the project on server with the CMD "cross-env NODE_ENV=production nodemon server/index.j".
// server/index.js
const nuxt = new Nuxt(config);
app.use(nuxt.render)
Now i am trying to compress the javascript files by turning on gzip mode in nginx. Although it works and makes the page load much quicker, i am still wondering if there is another way or webpack plugin to approach this like uglifyJS.
Upvotes: 1
Views: 3969
Reputation: 17621
Nuxt do minify and uglify js files by default for production builds. See docs here
Nuxt also have a build in webpack analyze. Docs You can check what js take most space and try to optimize it via treeshaking or replacing with other lib :)
Also dont use components globally, only use where u need them, that will help too.
Upvotes: 1