Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
nuxt-build-optimisations
Advanced tools
Nuxt.js v2 module to automatically make your builds faster.
Instantly speed up your Nuxt.js v2 build times.
Nuxt.js is fast but is limited by its webpack build, when your app grows things slow down.
Nuxt build optimisations abstracts the complexities of optimising your Nuxt.js app so anyone can instantly speed up their builds without having to learn webpack. The focus is primarily on the development build, as the optimisations are safer.
For the best possible performance, consider using: Nuxt Vite. This package is for webpack stuck projects.
Development: :snowman: 2-5x quicker cold starts, :fire: almost instant hot starts (with "risky" profile)
Production: Should be a slight performance improvement depending on profile.
Features are enabled by their risk profile. The risk profile is the likelihood of issues coming up.
Safe (safest)
file-loader
Experimental (mostly safe)
Risky (may throw errors)
Install using yarn or npm. (Nuxt.js 2.10+ is required)
yarn add nuxt-build-optimisations
npm i nuxt-build-optimisations
:warning: This package makes optimisations with the assumption you're developing on the latest chrome.
Within your nuxt.config.js
add the following.
// nuxt.config.js
buildModules: [
'nuxt-build-optimisations',
],
It's recommended you start with the default configuration, which is the experimental
profile.
However if you'd like to try and get more performance you can try the following:
// nuxt.config.js
buildOptimisations: {
profile: process.env.NODE_ENV === 'development' ? 'risky' : 'experimental'
},
⚠️ Note: The risky profile uses HardSource caching, if you use it in your production CI with node / npm caching then you need to make sure it caches per branch.
A lot of the speed improvements are from heavy caching, if you have any issues the first thing you should do is clear your cache.
rm -rf node_modules/.cache
//windows
rd /s "node_modules/.cache"
Type: risky
| experimental
| safe
| false
Default: experimental
If you have errors on any mode you should increment down in profiles until you find one that works.
Setting the profile to false will disable the optimisations, useful when you want to measure your build time without optimisations.
Type: boolean
or object
Default: false
When measure is enabled with true (options or environment variable), it will use the speed-measure-webpack-plugin
.
If the measure option is an object it is assumed to be speed-measure-webpack-plugin options.
buildOptimisations: {
measure: {
outputFormat: 'humanVerbose',
granularLoaderData: true,
loaderTopFiles: 10
}
}
You can use an environment variable to enable the measure as well.
package.json
{
"scripts": {
"measure": "export NUXT_MEASURE=true; nuxt dev"
}
}
Note: Some features are disabled with measure on, such as caching.
Type: client
| server
| modern
| all
Default: client
Configure which build will be measured. Note that non-client builds may be buggy and mess with HMR.
buildOptimisations: {
measureMode: 'all'
}
Type: object
Default:
// uses esbuild loader
esbuildLoader: boolean
// uses esbuild as a minifier
esbuildMinifier: boolean
// swaps url-loader for file-loader
imageFileLoader: boolean
// misc webpack optimisations
webpackOptimisations: boolean
// no polyfilling css in development
postcssNoPolyfills: boolean
// inject the webpack cache-loader loader
cacheLoader: boolean
// use the hardsource plugin
hardSourcePlugin: boolean
// use the parallel thread plugin
parallelPlugin: boolean
You can disable features if you'd like to skip optimisations.
buildOptimisations: {
features: {
// use url-loader
imageFileLoader: false
}
}
Type: object
or (args) => object
Default:
{
target: 'es2015'
}
See esbuild-loader.
Type: object
or (args) => object
Default:
{
target: 'es2015'
}
See esbuild-loader.
Your babel-loader will be replaced with esbuild, which doesn't support class decorators in js.
You can either migrate your scripts to typescript or disabled the esbuild loader.
Disable Loader
buildOptimisations: {
features: {
esbuildLoader: false
}
}
Migrate to TypeScript
tsconfig.json
{
"experimentalDecorators": true
}
<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component'
@Component
export default class HelloWorld extends Vue {
data () {
return {
hello: 'test'
}
}
}
</script>
FAQs
Nuxt.js v2 module to automatically make your builds faster.
The npm package nuxt-build-optimisations receives a total of 572 weekly downloads. As such, nuxt-build-optimisations popularity was classified as not popular.
We found that nuxt-build-optimisations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.