feat: added nuxt buildModules webpackOptimisations and compress

This commit is contained in:
wommy 2024-10-31 21:43:53 -04:00
parent 2b18efdfdc
commit 27c33209d3
6 changed files with 1622 additions and 245 deletions

View File

@ -51,6 +51,8 @@ module.exports = {
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/tailwindcss
'nuxt-webpack-optimisations',
'nuxt-compress',
'@nuxtjs/pwa'
],
@ -112,7 +114,14 @@ module.exports = {
},
// Build Configuration: https://go.nuxtjs.dev/config-build
modern: true,
build: {
parallel: true,
splitChunks: {
layouts: true,
pages: true,
commons: true
},
postcss: {
postcssOptions: {
plugins: {

1779
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,8 @@
"devDependencies": {
"@nuxtjs/pwa": "^3.3.5",
"autoprefixer": "^10.4.7",
"nuxt-compress": "^5.0.0",
"nuxt-webpack-optimisations": "^2.2.8",
"postcss": "^8.3.6",
"tailwindcss": "^3.4.1"
},

73
package-lock.json generated
View File

@ -13,6 +13,7 @@
"cookie-parser": "^1.4.6",
"express": "^4.17.1",
"express-session": "^1.17.3",
"express-static-gzip": "^2.1.8",
"graceful-fs": "^4.2.10",
"htmlparser2": "^8.0.1",
"lru-cache": "^10.0.3",
@ -1844,6 +1845,78 @@
"node": ">= 0.6"
}
},
"node_modules/express-static-gzip": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/express-static-gzip/-/express-static-gzip-2.1.8.tgz",
"integrity": "sha512-g8tiJuI9Y9Ffy59ehVXvqb0hhP83JwZiLxzanobPaMbkB5qBWA8nuVgd+rcd5qzH3GkgogTALlc0BaADYwnMbQ==",
"license": "MIT",
"dependencies": {
"serve-static": "^1.16.2"
}
},
"node_modules/express-static-gzip/node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/express-static-gzip/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/express-static-gzip/node_modules/send": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
"integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
"license": "MIT",
"dependencies": {
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "2.0.0",
"mime": "1.6.0",
"ms": "2.1.3",
"on-finished": "2.4.1",
"range-parser": "~1.2.1",
"statuses": "2.0.1"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/express-static-gzip/node_modules/send/node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/express-static-gzip/node_modules/serve-static": {
"version": "1.16.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
"integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
"license": "MIT",
"dependencies": {
"encodeurl": "~2.0.0",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.19.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",

View File

@ -40,6 +40,7 @@
"cookie-parser": "^1.4.6",
"express": "^4.17.1",
"express-session": "^1.17.3",
"express-static-gzip": "^2.1.8",
"graceful-fs": "^4.2.10",
"htmlparser2": "^8.0.1",
"lru-cache": "^10.0.3",

View File

@ -1,6 +1,7 @@
const Path = require('path')
const Sequelize = require('sequelize')
const express = require('express')
const expressStaticGzip = require('express-static-gzip')
const http = require('http')
const util = require('util')
const fs = require('./libs/fsExtra')
@ -270,7 +271,7 @@ class Server {
// Static path to generated nuxt
const distPath = Path.join(global.appRoot, '/client/dist')
router.use(express.static(distPath))
router.use(expressStaticGzip(distPath))
// Static folder
router.use(express.static(Path.join(global.appRoot, 'static')))