title: Next.js typescript next.config.js doesn't work
body: <p>I try to use Next.js with TypeScript and I need add custom configuration. I had created a next.config.js file but looks like Next.js doesn't load it. For example custom environments variable unavailable. Here's my next.config.js</p>
  <pre><code>const withPlugins = require(&quot;next-compose-plugins&quot;);
  const optimizedImages = require(&quot;next-optimized-images&quot;);
  
  module.exports = withPlugins([
    [
      optimizedImages,
      {
        /* config for next-optimized-images */
        optimizeImages: false,
      },
    ],
    {
      reactStrictMode: true,
      // images: {
      //   domains: ['localhost:3000'],
      //   path: `uploads/_next/image`
      // imageSizes: [16, 32, 48, 64, 96, 128, 256, 384]
      // },
      env: {
        baseUrl: &quot;http://localhost:3001&quot;,
        apiUrl: &quot;http://localhost:5000&quot;,
      },
    },
  
    // your other plugins here
  ]);
  </code></pre>
  <p>For example when I try to access baseUrl like process.env.baseUrl I get an error</p>
  <blockquote>
  <p>Server Error
  Error: baseUrl is undefined.</p>
  </blockquote>
  <p>Same config is working correct with JavaScript version of Next.js.</p>
  <p>So what I do wrong?</p>