mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 08:58:30 -04:00
fix NextConfig types in next.config.js
This commit is contained in:
parent
ee1b708b99
commit
18b2fc7d83
226
next.config.js
226
next.config.js
@ -1,131 +1,119 @@
|
|||||||
/**
|
|
||||||
* @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 = [
|
||||||
|
require("next-transpile-modules")([
|
||||||
|
// fixes some mystery issues in the noVNC library
|
||||||
|
"@novnc/novnc",
|
||||||
|
]),
|
||||||
|
require("@next/bundle-analyzer")({
|
||||||
|
enabled: process.env.ANALYZE === "true",
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
return withPlugins(
|
/**
|
||||||
[
|
* @type {import("next").NextConfig}
|
||||||
require("next-transpile-modules")([
|
*/
|
||||||
// fixes some mystery issues in the noVNC library
|
const nextConfig = {
|
||||||
"@novnc/novnc",
|
swcMinify: true,
|
||||||
]),
|
reactStrictMode: true,
|
||||||
require("@next/bundle-analyzer")({
|
trailingSlash: true,
|
||||||
enabled: process.env.ANALYZE === "true",
|
productionBrowserSourceMaps: true,
|
||||||
}),
|
env: {
|
||||||
],
|
IS_DEV_SERVER: phase === PHASE_DEVELOPMENT_SERVER,
|
||||||
{
|
},
|
||||||
swcMinify: true,
|
images: {
|
||||||
reactStrictMode: true,
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
||||||
trailingSlash: true,
|
},
|
||||||
productionBrowserSourceMaps: true,
|
webpack: (config) => {
|
||||||
env: {
|
config.module.rules.push({
|
||||||
IS_DEV_SERVER,
|
test: /\.svg$/,
|
||||||
},
|
issuer: { and: [/\.(js|ts)x?$/] },
|
||||||
images: {
|
include: [
|
||||||
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
path.resolve(__dirname, "components/icons"),
|
||||||
},
|
// slight workaround to grab svg files from these packages directly instead of through their exports:
|
||||||
experimental: {
|
path.resolve(__dirname, "node_modules/@primer/octicons/build/svg"),
|
||||||
optimizeFonts: true,
|
path.resolve(__dirname, "node_modules/feather-icons/dist/icons"),
|
||||||
optimizeImages: true,
|
path.resolve(__dirname, "node_modules/simple-icons/icons"),
|
||||||
},
|
path.resolve(__dirname, "node_modules/twemoji/assets/svg"),
|
||||||
webpack: (config) => {
|
],
|
||||||
config.module.rules.push({
|
use: [
|
||||||
test: /\.svg$/,
|
{
|
||||||
issuer: { and: [/\.(js|ts)x?$/] },
|
loader: "@svgr/webpack",
|
||||||
include: [
|
options: {
|
||||||
path.resolve(__dirname, "components/icons"),
|
icon: true,
|
||||||
// slight workaround to grab svg files from these packages directly instead of through their exports:
|
typescript: true,
|
||||||
path.resolve(__dirname, "node_modules/@primer/octicons/build/svg"),
|
svgProps: {
|
||||||
path.resolve(__dirname, "node_modules/feather-icons/dist/icons"),
|
"aria-hidden": true,
|
||||||
path.resolve(__dirname, "node_modules/simple-icons/icons"),
|
|
||||||
path.resolve(__dirname, "node_modules/twemoji/assets/svg"),
|
|
||||||
],
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: "@svgr/webpack",
|
|
||||||
/** @type {import('@svgr/webpack').LoaderOptions} */
|
|
||||||
options: {
|
|
||||||
icon: true,
|
|
||||||
typescript: true,
|
|
||||||
svgProps: {
|
|
||||||
"aria-hidden": true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
},
|
||||||
});
|
],
|
||||||
|
});
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
},
|
||||||
|
headers: async () => [
|
||||||
|
{
|
||||||
|
source: "/:path(.*)",
|
||||||
|
headers: [
|
||||||
|
{
|
||||||
|
key: "Onion-Location",
|
||||||
|
value: `${config.onionDomain}/:path*`,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
headers: async () => [
|
{
|
||||||
{
|
source: "/pubkey.asc",
|
||||||
source: "/:path(.*)",
|
headers: [
|
||||||
headers: [
|
{
|
||||||
{
|
key: "Cache-Control",
|
||||||
key: "Onion-Location",
|
value: "private, no-cache, no-store, must-revalidate",
|
||||||
value: `${config.onionDomain}/:path*`,
|
},
|
||||||
},
|
{
|
||||||
],
|
key: "Content-Type",
|
||||||
},
|
value: "text/plain; charset=utf-8",
|
||||||
{
|
},
|
||||||
source: "/pubkey.asc",
|
],
|
||||||
headers: [
|
},
|
||||||
{
|
],
|
||||||
key: "Cache-Control",
|
rewrites: async () => [
|
||||||
value: "private, no-cache, no-store, must-revalidate",
|
{ source: "/favicon.ico", destination: "/static/favicons/favicon.ico" },
|
||||||
},
|
{ source: "/apple-touch-icon.png", destination: "/static/favicons/apple-touch-icon.png" },
|
||||||
{
|
{ source: "/apple-touch-icon-precomposed.png", destination: "/static/favicons/apple-touch-icon.png" },
|
||||||
key: "Content-Type",
|
],
|
||||||
value: "text/plain; charset=utf-8",
|
redirects: async () => [
|
||||||
},
|
{ source: "/notes/:slug/amp.html", destination: "/notes/:slug/", statusCode: 301 },
|
||||||
],
|
{ source: "/resume/", destination: "/static/resume.pdf", permanent: false },
|
||||||
},
|
{ source: "/resume.pdf", destination: "/static/resume.pdf", permanent: true },
|
||||||
],
|
{ source: "/stats/", destination: "https://app.usefathom.com/share/wbgnqukw/jarv.is", permanent: false },
|
||||||
rewrites: async () => [
|
{ source: "/scrabble/:path*", destination: "https://jakejarvis.github.io/scrabble/:path*", permanent: false },
|
||||||
{ source: "/favicon.ico", destination: "/static/favicons/favicon.ico" },
|
{ source: "/jarvis.asc", destination: "/pubkey.asc", permanent: true },
|
||||||
{ source: "/apple-touch-icon.png", destination: "/static/favicons/apple-touch-icon.png" },
|
{ source: "/index.xml", destination: "/feed.xml", permanent: true },
|
||||||
{ source: "/apple-touch-icon-precomposed.png", destination: "/static/favicons/apple-touch-icon.png" },
|
{ source: "/feed/", destination: "/feed.xml", permanent: true },
|
||||||
],
|
{ source: "/rss/", destination: "/feed.xml", permanent: true },
|
||||||
redirects: async () => [
|
{ source: "/blog/:path*", destination: "/notes/", permanent: true },
|
||||||
{ source: "/notes/:slug/amp.html", destination: "/notes/:slug/", statusCode: 301 },
|
{ source: "/archives/:path*", destination: "/notes/", permanent: true },
|
||||||
{ source: "/resume/", destination: "/static/resume.pdf", permanent: false },
|
{
|
||||||
{ source: "/resume.pdf", destination: "/static/resume.pdf", permanent: true },
|
source: "/2016/02/28/millenial-with-hillary-clinton/",
|
||||||
{ source: "/stats/", destination: "https://app.usefathom.com/share/wbgnqukw/jarv.is", permanent: false },
|
destination: "/notes/millenial-with-hillary-clinton/",
|
||||||
{ source: "/scrabble/:path*", destination: "https://jakejarvis.github.io/scrabble/:path*", permanent: false },
|
permanent: true,
|
||||||
{ source: "/jarvis.asc", destination: "/pubkey.asc", permanent: true },
|
},
|
||||||
{ source: "/index.xml", destination: "/feed.xml", permanent: true },
|
{
|
||||||
{ source: "/feed/", destination: "/feed.xml", permanent: true },
|
source: "/2018/12/04/how-to-shrink-linux-virtual-disk-vmware/",
|
||||||
{ source: "/rss/", destination: "/feed.xml", permanent: true },
|
destination: "/notes/how-to-shrink-linux-virtual-disk-vmware/",
|
||||||
{ source: "/blog/:path*", destination: "/notes/", permanent: true },
|
permanent: true,
|
||||||
{ source: "/archives/:path*", destination: "/notes/", permanent: true },
|
},
|
||||||
{
|
{
|
||||||
source: "/2016/02/28/millenial-with-hillary-clinton/",
|
source: "/2018/12/10/cool-bash-tricks-for-your-terminal-dotfiles/",
|
||||||
destination: "/notes/millenial-with-hillary-clinton/",
|
destination: "/notes/cool-bash-tricks-for-your-terminal-dotfiles/",
|
||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
source: "/2018/12/04/how-to-shrink-linux-virtual-disk-vmware/",
|
};
|
||||||
destination: "/notes/how-to-shrink-linux-virtual-disk-vmware/",
|
|
||||||
permanent: true,
|
return withPlugins(nextPlugins, nextConfig)(phase, { defaultConfig });
|
||||||
},
|
|
||||||
{
|
|
||||||
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/",
|
|
||||||
destination: "/notes/cool-bash-tricks-for-your-terminal-dotfiles/",
|
|
||||||
permanent: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)(phase, { defaultConfig });
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user