1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 15:16:21 -04:00

fix NextConfig types in next.config.js

This commit is contained in:
Jake Jarvis 2022-02-06 20:44:54 -05:00
parent ee1b708b99
commit 18b2fc7d83
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39

View File

@ -1,17 +1,10 @@
/**
* @type {import('next').NextConfig}
*/
const path = require("path"); const path = require("path");
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants"); const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
const withPlugins = require("next-compose-plugins"); const withPlugins = require("next-compose-plugins");
const config = require("./lib/config"); const config = require("./lib/config");
module.exports = (phase, { defaultConfig }) => { module.exports = (phase, { defaultConfig }) => {
const IS_DEV_SERVER = phase === PHASE_DEVELOPMENT_SERVER; const nextPlugins = [
return withPlugins(
[
require("next-transpile-modules")([ require("next-transpile-modules")([
// fixes some mystery issues in the noVNC library // fixes some mystery issues in the noVNC library
"@novnc/novnc", "@novnc/novnc",
@ -19,22 +12,22 @@ module.exports = (phase, { defaultConfig }) => {
require("@next/bundle-analyzer")({ require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true", enabled: process.env.ANALYZE === "true",
}), }),
], ];
{
/**
* @type {import("next").NextConfig}
*/
const nextConfig = {
swcMinify: true, swcMinify: true,
reactStrictMode: true, reactStrictMode: true,
trailingSlash: true, trailingSlash: true,
productionBrowserSourceMaps: true, productionBrowserSourceMaps: true,
env: { env: {
IS_DEV_SERVER, IS_DEV_SERVER: phase === PHASE_DEVELOPMENT_SERVER,
}, },
images: { images: {
deviceSizes: [640, 750, 828, 1080, 1200, 1920], deviceSizes: [640, 750, 828, 1080, 1200, 1920],
}, },
experimental: {
optimizeFonts: true,
optimizeImages: true,
},
webpack: (config) => { webpack: (config) => {
config.module.rules.push({ config.module.rules.push({
test: /\.svg$/, test: /\.svg$/,
@ -50,7 +43,6 @@ module.exports = (phase, { defaultConfig }) => {
use: [ use: [
{ {
loader: "@svgr/webpack", loader: "@svgr/webpack",
/** @type {import('@svgr/webpack').LoaderOptions} */
options: { options: {
icon: true, icon: true,
typescript: true, typescript: true,
@ -115,17 +107,13 @@ module.exports = (phase, { defaultConfig }) => {
destination: "/notes/how-to-shrink-linux-virtual-disk-vmware/", destination: "/notes/how-to-shrink-linux-virtual-disk-vmware/",
permanent: true, permanent: true,
}, },
{
source: "/2018/12/07/shrinking-a-linux-virtual-disk-with-vmware/",
destination: "/notes/how-to-shrink-linux-virtual-disk-vmware/",
permanent: true,
},
{ {
source: "/2018/12/10/cool-bash-tricks-for-your-terminal-dotfiles/", source: "/2018/12/10/cool-bash-tricks-for-your-terminal-dotfiles/",
destination: "/notes/cool-bash-tricks-for-your-terminal-dotfiles/", destination: "/notes/cool-bash-tricks-for-your-terminal-dotfiles/",
permanent: true, permanent: true,
}, },
], ],
} };
)(phase, { defaultConfig });
return withPlugins(nextPlugins, nextConfig)(phase, { defaultConfig });
}; };