From c13d8e7877b807b8c8e50033b0448a6f5b967c70 Mon Sep 17 00:00:00 2001 From: Philip <4144601+philipbrembeck@users.noreply.github.com> Date: Thu, 17 Aug 2023 23:40:19 +0200 Subject: [PATCH] feat(Million): Added Million package to optimize DOM --- next.config.js | 38 +++++++++++++-------- package-lock.json | 84 ++++++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + 3 files changed, 108 insertions(+), 15 deletions(-) diff --git a/next.config.js b/next.config.js index 63462db..05bdb13 100644 --- a/next.config.js +++ b/next.config.js @@ -1,24 +1,34 @@ -const withPWA = require('next-pwa')({ - dest: 'public', - swSrc: 'service-worker.js' -}) +const million = require("million/compiler"); +const withPWA = require("next-pwa")({ + dest: "public", + swSrc: "service-worker.js", +}); /** @type {import('next').NextConfig} */ - -module.exports = withPWA({ - output: 'standalone', +let nextConfig = { + output: "standalone", reactStrictMode: true, productionBrowserSourceMaps: true, i18n: { - locales: ['de', 'en', 'fr', 'es', 'pl', 'cz'], - defaultLocale: 'en', + locales: ["de", "en", "fr", "es", "pl", "cz"], + defaultLocale: "en", }, async rewrites() { return [ { - source: '/datenschutz', - destination: '/privacy-policy', + source: "/datenschutz", + destination: "/privacy-policy", }, - ] - } -}); \ No newline at end of file + ]; + }, +}; + +const millionConfig = { + auto: true, + // if you're using RSC: + // auto: { rsc: true }, +}; + +nextConfig = million.next(nextConfig, millionConfig); + +module.exports = withPWA(nextConfig); diff --git a/package-lock.json b/package-lock.json index d86a284..cb10351 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@types/react-dom": "18.2.7", "eslint-config-sznm": "^2.0.2", "jest-worker": "^29.6.2", + "million": "^2.5.13", "next": "13.4.16", "next-intl": "^2.19.1", "next-pwa": "^5.6.0", @@ -699,6 +700,20 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-logical-assignment-operators": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", @@ -793,6 +808,20 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", @@ -3356,6 +3385,18 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-transform-react-createelement-to-jsx": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-createelement-to-jsx/-/babel-plugin-transform-react-createelement-to-jsx-1.1.0.tgz", + "integrity": "sha512-43xMHy06ARCmF8UKte/9OJ+gp5bh51UoUe5SYTSBh3zFtcjxzCTzwKyGv8uOWGQNYrrPAl6iyynxARSXDCXoNA==", + "dependencies": { + "@babel/plugin-syntax-jsx": "^7.0.0", + "@babel/polyfill": "^7.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -6174,6 +6215,14 @@ "node": ">=4.0" } }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/language-subtag-registry": { "version": "0.3.22", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", @@ -6337,6 +6386,24 @@ "node": ">=8.6" } }, + "node_modules/million": { + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/million/-/million-2.5.13.tgz", + "integrity": "sha512-6PiH6D9zPOi7Ba2NMtxZJHL7LBoIy11iM7sNeqNpqiHq44Rzu+yYyvIjYIrOL5QVdxBif+FrUTpeWWPIAsYuXg==", + "dependencies": { + "@babel/core": "^7.21.0", + "@babel/generator": "^7.22.7", + "@babel/plugin-syntax-jsx": "^7.21.4", + "@babel/plugin-syntax-typescript": "^7.21.4", + "@babel/types": "^7.21.3", + "babel-plugin-transform-react-createelement-to-jsx": "^1.1.0", + "kleur": "^4.1.5", + "unplugin": "^1.3.1" + }, + "funding": { + "url": "https://github.com/sponsors/aidenybai" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -8399,6 +8466,17 @@ "node": ">= 10.0.0" } }, + "node_modules/unplugin": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.4.0.tgz", + "integrity": "sha512-5x4eIEL6WgbzqGtF9UV8VEC/ehKptPXDS6L2b0mv4FRMkJxRtjaJfOWDd6a8+kYbqsjklix7yWP0N3SUepjXcg==", + "dependencies": { + "acorn": "^8.9.0", + "chokidar": "^3.5.3", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.5.0" + } + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -8558,11 +8636,15 @@ "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", - "peer": true, "engines": { "node": ">=10.13.0" } }, + "node_modules/webpack-virtual-modules": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", + "integrity": "sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==" + }, "node_modules/webpack/node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", diff --git a/package.json b/package.json index 2d0b405..b9c7b97 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@types/react-dom": "18.2.7", "eslint-config-sznm": "^2.0.2", "jest-worker": "^29.6.2", + "million": "^2.5.13", "next": "13.4.16", "next-intl": "^2.19.1", "next-pwa": "^5.6.0",