const path = require('path'); const { withMarkdownLoader } = require('./plugins'); const DISPLAY_DOMAIN = process.env.DISPLAY_DOMAIN; if(!DISPLAY_DOMAIN) throw Error("Please define a display domain"); const exportDir = `export/${DISPLAY_DOMAIN}`; module.exports = () => { const plugins = [ withMarkdownLoader, ]; const webpackConfig = plugins.reduce((config, withFunc) => withFunc(config), {}); return { ...webpackConfig, sassOptions: { includePaths: [path.join(__dirname, 'styles')] }, env: { DISPLAY_DOMAIN: DISPLAY_DOMAIN, }, output: 'export', distDir: exportDir, }; }