mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-07-21 19:35:59 -04:00
update mdx/terser config
This commit is contained in:
@@ -24,7 +24,6 @@ module.exports = {
|
||||
githubRepo: "jakejarvis/jarv.is",
|
||||
verifyGoogle: "qQhmLTwjNWYgQ7W42nSTq63xIrTch13X_11mmxBE9zk",
|
||||
verifyBing: "164551986DA47F7F6FC0D21A93FFFCA6",
|
||||
verifyFacebook: "q45jxbgyp22ef55xror1pvbehisg9m",
|
||||
fathomSiteId: "WBGNQUKW",
|
||||
webmentionId: "jarv.is",
|
||||
giscusConfig: {
|
||||
|
||||
+15
-11
@@ -17,6 +17,7 @@ import rehypeSlug from "rehype-slug";
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import rehypePrism from "rehype-prism-plus/common";
|
||||
|
||||
import type { MinifyOptions } from "terser";
|
||||
import type { NoteMetaType, NoteType } from "../types";
|
||||
|
||||
// returns all .mdx files in NOTES_DIR (without .mdx extension)
|
||||
@@ -73,20 +74,23 @@ export const getNote = async (slug: string): Promise<NoteType> => {
|
||||
},
|
||||
});
|
||||
|
||||
// next-mdx-remote v4 doesn't (yet?) minify compiled JSX output, see:
|
||||
// HACK: next-mdx-remote v4 doesn't (yet?) minify compiled JSX output, see:
|
||||
// https://github.com/hashicorp/next-mdx-remote/pull/211#issuecomment-1013658514
|
||||
// ...so for now do it manually (and conservatively) with terser when building for production.
|
||||
// ...so for now, let's do it manually (and conservatively) with terser when building for production.
|
||||
const terserOptions: MinifyOptions = {
|
||||
ecma: 2018,
|
||||
module: true,
|
||||
parse: {
|
||||
bare_returns: true,
|
||||
},
|
||||
compress: {
|
||||
defaults: true,
|
||||
},
|
||||
sourceMap: false,
|
||||
};
|
||||
const compiledSource =
|
||||
process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
|
||||
? (
|
||||
await minify(source.compiledSource, {
|
||||
ecma: 2018,
|
||||
module: true,
|
||||
parse: { bare_returns: true },
|
||||
compress: { defaults: true },
|
||||
sourceMap: false,
|
||||
})
|
||||
).code
|
||||
? (await minify(source.compiledSource, terserOptions)).code
|
||||
: source.compiledSource;
|
||||
|
||||
return {
|
||||
|
||||
@@ -51,10 +51,6 @@ export const defaultSeo: DefaultSeoProps = {
|
||||
name: "msvalidate.01",
|
||||
content: config.verifyBing,
|
||||
},
|
||||
{
|
||||
name: "facebook-domain-verification",
|
||||
content: config.verifyFacebook,
|
||||
},
|
||||
],
|
||||
additionalLinkTags: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user