rofrischmann/elodin

View on GitHub
website/next.config.js

Summary

Maintainability
B
4 hrs
Test Coverage
var withMDX = require('@next/mdx')

var withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
})

module.exports = withBundleAnalyzer(
  withMDX({
    extension: /\.(md|mdx)$/,
  })({
    pageExtensions: ['js', 'mdx'],
    target: 'serverless',
    async redirects() {
      return [
        {
          source: '/docs',
          destination: '/docs/intro/what-why',
          permanent: true,
        },
      ]
    },
    webpack(config) {
      for (const rule of config.module.rules) {
        if (!rule.oneOf) {
          continue
        }

        // removing the global css restriction
        // do not touch this
        const cssRule = rule.oneOf[2]

        cssRule.test = /.css$/
        cssRule.use.forEach((use) => {
          if (use.loader.indexOf('css-loader') !== -1) {
            use.options.modules = false
          }
        })
      }

      config.node.fs = 'empty'

      return config
    },
  })
)