I have an application based on Nuxt. Eslint is also included. When I need to rebuild application it spend about 10 minutes. I dont understand it. Somebody tell me I have a slow laptop. Its params are i5, 8G ram, 500G SSD, Win10. What could I do to speed up the build?
PS is it possible to disable EsLint for development?
Here is the nuxt.config.js
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "lurity",
htmlAttrs: {
lang: "en",
},
meta: [
{ charset: "utf-8" },
{
name: "viewport",
content: "width=device-width, initial-scale=1",
},
{ hid: "description", name: "description", content: "" },
{ name: "format-detection", content: "telephone=no" },
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
},
server: {
port: process.env.PORT, // default: 3000
host: process.env.HOST, // default: localhost
},
modern: true,
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
"@mdi/font/css/materialdesignicons.css",
"@/assets/scss/bulma_styled.scss",
"@/assets/scss/lurity.scss",
],
router: {
middleware: "auth",
},
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
"~/plugins/helpers.js",
"~/plugins/apiCalls.js",
"~/plugins/vue-lazyload.client.js",
{ src: "~/plugins/vue-intersect.client.js", mode: "client" },
{ src: "~/plugins/gmaps.client.js", mode: "client" },
{ src: "~/plugins/google-auth.client.js", mode: "client" },
{ src: "~/plugins/google-tag-manager.client.js", mode: "client" },
{ src: "~/plugins/debounce.client.js", mode: "client" },
{ src: "~/plugins/braintree.client.js", mode: "client" },
{ src: "~/plugins/charts.client.js", mode: "client" },
{ src: "~/plugins/vuex-persist.client.js", mode: "client" },
{ src: "~plugins/leaflet.client.js", mode: "client" },
{ src: "~plugins/nuxt-client-init.client.js", mode: "client" },
"~/plugins/map-location.js",
"~/plugins/notify.js"
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
"@nuxtjs/eslint-module",
"@nuxtjs/composition-api/module",
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/buefy
"nuxt-buefy",
// https://go.nuxtjs.dev/axios
"@nuxtjs/axios",
"@nuxtjs/proxy",
[
"nuxt-i18n",
{
locales: [
{
code: "en",
iso: "en-GB",
file: "en_locale.js",
},
{
code: "sk",
iso: "sk-SK",
file: "sk_locale.js",
},
{
code: "cz",
iso: "cs-CZ",
file: "cs_locale.js",
},
],
defaultLocale: "en",
strategy: "no_prefix",
lazy: true,
vueI18n: {
silentTranslationWarn: true,
silentFallbackWarn: true,
},
langDir: "locales/",
// Enable browser language detection to automatically redirect user
// to their preferred language as they visit your app for the first time
// Set to false to disable
detectBrowserLanguage: {
// If enabled, a cookie is set once a user has been redirected to his
// preferred language to prevent subsequent redirections
// Set to false to redirect every time
useCookie: true,
// Cookie name
cookieKey: "i18n_redirected",
// Set to always redirect to value stored in the cookie, not just once
alwaysRedirect: false,
// If no locale for the browsers locale is a match, use this one as a fallback
fallbackLocale: "en",
},
},
],
],
buefy: { css: false, materialDesignIcons: false, defaultLocale: "sk-SK" },
proxy: {
// Simple proxy
"/api": {
target:
process.env.PROXY || (process.env.NODE_ENV === "production"
? "https://portal-api.lurity.com"
: "https://portaldev-api.lurity.com"),
},
},
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
proxy: true,
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: ["vuex-stores"],
loaders: {
scss: {
sourceMap: true,
implementation: require("sass"),
additionalData: `@import "~@/assets/scss/_bulma_variables.scss"; @import "~@/assets/scss/variables.scss";`,
},
},
},
};
CodePudding user response:
There is nothing really shocking here in terms of configuration (nuxt.config.js
).
So I guess that it depends on what is running on your machine when you do build. Also, I'm not sure if the build is slower or not in Windows but this could also be a reason.
You could probably ask a friend or share a github link to people with a more beefy hardware configuration to diagnose the build speed.
I do run the following in my rig:
- latest LTS ubuntu (
20.04
) - 2x 32GB of DDR4 4000MHz Trident Z royal CAS 18
- Ryzen R9 5950x @stock
- 2TB Samsung Pro NVME
And what is mainly helping from my experience, is a good chunk of RAM (amount) speed to fit with your CPU. Then, it all comes down to the Webpack settings or other build tools related settings IMO.
Lastly, without precise numbers, this question is a bit hard to answer.
Another thing, is maybe looking of the actual build and try to figure out what is slow with your own eyes, it will narrow down your problem IMO.
CodePudding user response:
10 minutes is a ridiculous amount of time to build. I don't know why it would be 10 minutes. But, if you are asking for a way to increase the build speed of Nuxt, you can use Vite! Just came out, it's amazing for increasing build speed. https://vite.nuxtjs.org/