|
|
@ -1,6 +1,31 @@ |
|
|
|
const path = require('path'); |
|
|
|
const path = require('path'); |
|
|
|
|
|
|
|
const fs = require('fs'); |
|
|
|
const rehypePrism = require('@mapbox/rehype-prism'); |
|
|
|
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')({ |
|
|
|
const withMDX = require('@next/mdx')({ |
|
|
|
extension: /\.(md|mdx)?$/, |
|
|
|
extension: /\.(md|mdx)?$/, |
|
|
|
options: { |
|
|
|
options: { |
|
|
@ -11,6 +36,7 @@ const withMDX = require('@next/mdx')({ |
|
|
|
let nextConfig = { |
|
|
|
let nextConfig = { |
|
|
|
reactStrictMode: true, |
|
|
|
reactStrictMode: true, |
|
|
|
poweredByHeader: false, |
|
|
|
poweredByHeader: false, |
|
|
|
|
|
|
|
env: loadConfig(process.env.NODE_ENV), |
|
|
|
|
|
|
|
|
|
|
|
webpack(config, options) { |
|
|
|
webpack(config, options) { |
|
|
|
config.resolve.modules.push(path.resolve('./')); |
|
|
|
config.resolve.modules.push(path.resolve('./')); |
|
|
|