mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-07-21 19:35:59 -04:00
only minify compiled MDX source in production
This commit is contained in:
+17
-12
@@ -73,21 +73,26 @@ export const getNote = async (slug: string): Promise<NoteType> => {
|
||||
},
|
||||
});
|
||||
|
||||
// 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.
|
||||
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
|
||||
: source.compiledSource;
|
||||
|
||||
return {
|
||||
frontMatter,
|
||||
source: {
|
||||
// next-mdx-remote v4 doesn't (yet?) minify compiled JSX output, see:
|
||||
// https://github.com/hashicorp/next-mdx-remote/pull/211#issuecomment-1013658514
|
||||
// ...so do it manually (and conservatively) with terser for now.
|
||||
compiledSource: (
|
||||
await minify(source.compiledSource, {
|
||||
ecma: 2018,
|
||||
module: true,
|
||||
parse: { bare_returns: true },
|
||||
compress: { defaults: true },
|
||||
sourceMap: false,
|
||||
})
|
||||
).code,
|
||||
compiledSource,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import meJpg from "../public/static/images/me.jpg";
|
||||
|
||||
export const defaultSeo: DefaultSeoProps = {
|
||||
defaultTitle: `${config.siteName} – ${config.shortDescription}`,
|
||||
titleTemplate: `%s – ${config.siteName}`, // appends `– siteName` to title provided by each page
|
||||
titleTemplate: `%s – ${config.siteName}`, // appends `– siteName` to title provided by each page (except home)
|
||||
description: config.longDescription,
|
||||
openGraph: {
|
||||
site_name: config.siteName,
|
||||
|
||||
Reference in New Issue
Block a user