Roadmap to becoming a developer in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

67 lines
1.3 KiB

const path = require('path');
const fs = require('fs');
const rehypePrism = require('@mapbox/rehype-prism');
/**
* Loads the configuration for the given environment
* @param env
* @returns {*}
*/
const loadConfig = (env = 'dev') => {
const configPath = `./config/${env}.json`;
if (!fs.existsSync(configPath)) {
console.warn(`Config file not found: ${configPath}. Using environment variables only.`);
}
const appConfig = {};
for (let key in process.env) {
if (!key.startsWith('ROADMAP_')) {
continue;
}
appConfig[key.replace('ROADMAP_', '')] = process.env[key];
}
return appConfig;
};
const withMDX = require('@next/mdx')({
extension: /\.(md|mdx)?$/,
options: {
rehypePlugins: [rehypePrism]
}
});
let nextConfig = {
reactStrictMode: true,
poweredByHeader: false,
env: loadConfig(process.env.NODE_ENV),
webpack(config, options) {
config.resolve.modules.push(path.resolve('./'));
// Transforms SVGs to components
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack']
});
return config;
},
async redirects() {
return [
{
source: '/node.js',
destination: '/nodejs',
permanent: true,
},
]
},
};
nextConfig = withMDX(nextConfig);
module.exports = nextConfig;