-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
67 lines (57 loc) · 1.8 KB
/
next.config.mjs
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import remarkFrontmatter from 'remark-frontmatter'
import remarkMdxFrontmatter from 'remark-mdx-frontmatter'
import nextMdx from '@next/mdx'
import webpackMod from "webpack"
// For setting up on Github Pages
// https://github.com/gregrickaby/nextjs-github-pages
const isProd = process.env.NODE_ENV === 'production'
/** @type {import('next').NextConfig} */
const nextConfig = {
// Configure pageExtensions to include md and mdx
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
reactStrictMode: true,
// Experimental mdxRs needs to be OFF to work with remarkFrontmatter
// plugin to be able to strip the Frontmatter.
experimental: {
mdxRs: false,
},
// This is a static page, no dynamic content
output: "export",
trailingSlash: true,
images: { unoptimized: true },
webpack(config, options) {
const { isServer } = options;
const prefix = nextConfig.assetPrefix || '';
const basePath = nextConfig.basePath || '';
config.module.rules.push({
test: /\.(zip|mp4|bin|pdf)$/,
use: [
{
loader: 'file-loader',
options: {
publicPath: `${prefix || basePath}/_next/static/`,
outputPath: `${isServer ? '../' : ''}static/`,
name: '[name]-[hash].[ext]',
},
},
],
});
// for react-igc
config.plugins.push(
new webpackMod.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify('/cesium'),
}),
);
// TODO: This needs to be figured out! No idea why it's chucking errors
// config.optimization.minimizer = []
return config;
}
}
const withMDX = nextMdx({
// these options directly gets passed to `@mdx-js/loader`
options: {
remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter],
rehypePlugins: [],
},
});
export default withMDX(nextConfig)