-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
49 lines (48 loc) · 1.63 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module.exports = (phase, { defaultConfig }) => {
const fs = require("fs");
const path = require("path");
const { promisify } = require("util");
const copyFile = promisify(fs.copyFile);
const withFonts = require("next-fonts");
const images = require("remark-images");
const emoji = require("remark-emoji");
const withOptimizedImages = require("next-optimized-images");
const withMDX = require("@zeit/next-mdx")({
// parse mdx files
extension: /\.mdx?$/,
options: {
mdPlugins: [images, emoji]
}
});
return withFonts(
withOptimizedImages(
withMDX({
pageExtensions: ["js", "jsx", "md", "mdx"],
exportPathMap: async function(
defaultPathMap,
{ dev, dir, outDir, distDir, buildId }
) {
if (dev) {
return defaultPathMap;
}
await copyFile(
path.join(dir, "my-worker.js"),
path.join(outDir, "my-worker.js")
);
return defaultPathMap;
},
webpack: function(config, { dev }) {
config.node = {
fs: "empty"
};
// parse yaml so we can use config.yml
config.module.rules.push({
test: /\.ya?ml$/,
use: "js-yaml-loader"
});
return config;
}
})
)
);
};