-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
58 lines (53 loc) · 1.92 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
import remarkFrontmatter from 'remark-frontmatter';
import path from 'path';
import dotenv from 'dotenv';
import createMDX from '@next/mdx';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
dotenv.config();
const resolveRoot = (newPath) => {
return path.resolve(__dirname, newPath);
};
const withMDX = createMDX({
extension: /\.mdx?$/,
options: {
// If you use remark-gfm, you'll need to use next.config.mjs
// as the package is ESM only
// https://github.com/remarkjs/remark-gfm#install
remarkPlugins: [remarkFrontmatter],
rehypePlugins: [],
// If you use `MDXProvider`, uncomment the following line.
// providerImportSource: "@mdx-js/react",
},
});
export default withMDX({
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
webpack: (config) => {
const resolveAlias = config.resolve.alias;
config = {
...config,
resolve: {
...config.resolve,
alias: {
...resolveAlias,
Navbar: resolveRoot('./src/Components/Navbar/Navbar'),
ProjectCard: resolveRoot('./src/Components/HomePage/ProjectCard/ProjectCard'),
FeaturedArticleCard: resolveRoot('./src/Components/HomePage/FeaturedArticleCard/FeaturedArticleCard'),
ArticleWrapper: resolveRoot('./src/Components/ArticleWrapper/ArticleWrapper'),
ViewCount: resolveRoot('./src/Components/ViewCount/ViewCount'),
IncrementViewCount: resolveRoot('./src/Components/IncrementViewCount/IncrementViewCount'),
Quiz: resolveRoot('./src/Components/Quiz/Quiz'),
Question: resolveRoot('./src/Components/Quiz/Question/Question'),
},
},
};
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
config.devtool = process.env.NODE_ENV !== 'production' && 'eval-source-map';
return config;
},
});