Skip to content

Commit de2d2d8

Browse files
committed
testing
1 parent 90addb4 commit de2d2d8

7 files changed

+242
-46
lines changed

next.config.jsrenamed to next.config.mjs

+35-12
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,16 @@ import webpack from "webpack";
33
importrehypeSlugfrom'rehype-slug';
44
importremarkGfmfrom'remark-gfm';
55
importremarkCommentfrom'remark-comment';
6-
importnextMDXfrom"@next/mdx";
76
importremarkFrontmatterfrom'remark-frontmatter'
7+
importremarkMdxFrontmatterfrom"remark-mdx-frontmatter";
8+
import{createLoader}from'simple-functional-loader'
89

910
constbsconfig=JSON.parse(fs.readFileSync("./bsconfig.json"))
1011

1112
const{ ProvidePlugin }=webpack;
1213

1314
consttranspileModules=["rescript"].concat(bsconfig["bs-dependencies"]);
1415

15-
constwithMDX=nextMDX({
16-
extension: /\.mdx?$/,
17-
options: {
18-
remarkPlugins: [remarkComment,remarkGfm,remarkFrontmatter],
19-
providerImportSource: '@mdx-js/react',
20-
rehypePlugins: [rehypeSlug]
21-
},
22-
});
23-
2416
constconfig={
2517
pageExtensions: ["jsx","js","bs.js","mdx","mjs"],
2618
env: {
@@ -50,6 +42,37 @@ const config = {
5042
fullySpecified: false,
5143
},
5244
});
45+
46+
functionmainMdxLoader(plugins){
47+
return[
48+
createLoader(function(source){
49+
constresult=`${source}\n\nMDXContent.frontmatter = frontmatter`
50+
returnresult
51+
}),
52+
]
53+
}
54+
55+
config.module.rules.push({
56+
test: /\.mdx?$/,
57+
use: mainMdxLoader(),
58+
});
59+
60+
config.module.rules.push({
61+
test: /\.mdx?$/,
62+
use: [
63+
{
64+
loader: '@mdx-js/loader',
65+
/** @type {import('@mdx-js/loader').Options} */
66+
options: {
67+
remarkPlugins: [remarkComment,remarkGfm,remarkFrontmatter,remarkMdxFrontmatter],
68+
providerImportSource: '@mdx-js/react',
69+
rehypePlugins: [rehypeSlug]
70+
}
71+
}
72+
]
73+
});
74+
75+
5376
config.plugins.push(newProvidePlugin({React: "react"}));
5477
returnconfig;
5578
},
@@ -69,7 +92,7 @@ const config = {
6992
},
7093
};
7194

72-
exportdefaultwithMDX({
95+
exportdefault{
7396
transpilePackages: transpileModules,
7497
...config
75-
})
98+
}

package-lock.json

+195-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
close