Files
developer-roadmap/next.config.js

61 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-08-24 18:34:46 +04:00
const withSass = require('@zeit/next-sass');
2019-09-04 15:27:00 +04:00
const withCSS = require('@zeit/next-css');
2019-11-01 09:28:05 +04:00
const rehypePrism = require('@mapbox/rehype-prism')
2019-08-24 18:34:46 +04:00
2019-11-01 09:28:05 +04:00
const withMDX = require('@next/mdx')({
extension: /\.(md|mdx)?$/,
options: {
rehypePlugins: [rehypePrism],
},
});
const options = {
2019-10-18 23:40:37 +04:00
exportPathMap: () => {
2019-11-01 09:28:05 +04:00
// @todo make it dynamic for pages, authors and guides
2019-10-18 23:40:37 +04:00
return {
'/': { page: '/' },
'/about': { page: '/about' },
'/privacy': { page: '/privacy' },
'/terms': { page: '/terms' },
2019-10-31 00:54:53 +04:00
'/roadmaps': { page: '/roadmaps' },
2019-11-01 09:28:05 +04:00
'/guides': { page: '/guides' },
2019-10-31 00:54:53 +04:00
'/frontend': { page: '/[fallback]', query: "frontend" },
'/backend': { page: '/[fallback]', query: "backend" },
'/devops': { page: '/[fallback]', query: "devops" },
'/roadmaps/frontend': { page: '/roadmaps/[roadmap]', query: "frontend" },
'/roadmaps/backend': { page: '/roadmaps/[roadmap]', query: "backend" },
'/roadmaps/devops': { page: '/roadmaps/[roadmap]', query: "devops" },
2019-10-18 23:40:37 +04:00
};
},
2019-11-01 09:28:05 +04:00
// Allow mdx and md files to be pages
pageExtensions: ['jsx', 'js', 'mdx', 'md'],
2019-09-04 16:32:25 +04:00
webpack(config, options) {
2019-11-02 12:45:15 +04:00
// // Transforms SVGs to components
2019-09-04 16:32:25 +04:00
config.module.rules.push({
2019-11-02 12:45:15 +04:00
test: /\.svg$/,
use: ['@svgr/webpack'],
});
// Allow loading images
config.module.rules.push({
test: /\.(png|jpg|gif|eot|ttf|woff|woff2)$/,
2019-09-04 16:32:25 +04:00
use: {
loader: 'url-loader',
options: {
limit: 100000,
},
},
});
return config
},
2019-11-01 09:28:05 +04:00
};
//
let nextConfig = withSass(options);
nextConfig = withCSS(nextConfig);
nextConfig = withMDX(nextConfig);
module.exports = nextConfig;