text: const {
    PHASE_DEVELOPMENT_SERVER,
    PHASE_PRODUCTION_BUILD,
  } = require('next/constants')
  
  const getBuildConfig = (...args) => {
    const path = require('path')
    const withSCSS = require('@zeit/next-sass')
    const withPugins = require('next-compose-plugins')
    const postcssPresetEnv = require('postcss-preset-env')
    const postcssPresetEnvOptions = {
      features: {
        'custom-media-queries': true,
        'custom-selectors': true,
      },
    }
  
    const cssOptions = {
      postcssLoaderOptions: {
        plugins: [postcssPresetEnv(postcssPresetEnvOptions)],
      },
      sassLoaderOptions: {
        includePaths: [path.join(process.cwd(), 'src', 'common', 'css')],
      },
      cssModules: true,
      cssLoaderOptions: {
        importLoaders: 1,
        localIdentName: "[local]___[hash:base64:5]",
      }
    }
  
    const nextConfig = {
      webpack(config) {
        return config
      },
    }
    return withPugins([[withSCSS, cssOptions]], nextConfig)(
      ...args
    )
  }
  
  module.exports = (phase, ...rest) => {
    const shouldAddBuildConfig =
      phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD
    return shouldAddBuildConfig ? getBuildConfig(phase, ...rest) : {}
  }
  