question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nextconfig is not work when withTM on Next.js

See original GitHub issue

Version of antd-mobile

5.25.1

Operating system and its version

Others

Browser and its version

No response

Sandbox to reproduce

No response

What happened?

from this doc https://mobile.ant.design/zh/guide/ssr#nextjs

const withTM = require('next-transpile-modules')([
  'antd-mobile',
]);

module.exports = withTM({
  // 你项目中其他的 Next.js 配置
});

my next.config.js , next config is not work

next.config.js

const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    basePath: '/console',
    env: {
       host: "my.domain"
   }
}

const withTM = require('next-transpile-modules')([
    'antd-mobile',
]);

module.exports = withTM({
    nextConfig
});

# when i test env
console.log(`${process.env.host}`)
# result is
undefined

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
IronKinokocommented, Nov 18, 2022
const withTM = require('next-transpile-modules')([
  'antd-mobile',
]);

const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    basePath: '/console',
    env: {
       host: "my.domain"
   }
}

- module.exports = withTM({
-     nextConfig
- });

+ module.exports = withTM(nextConfig);
0reactions
xinzhanguocommented, Nov 22, 2022

My fault, it fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

next.config.js: Introduction
next.config.js is a regular Node.js module, not a JSON file. It gets used by the Next.js server and build phases, and it's not...
Read more >
Npm run build not working NEXTJS says TM undefined
I am trying to run npm run build on my NextJs project. ... Build error occurred ReferenceError: withTM is not defined at Object....
Read more >
Error: Failed to load next.config.js - Square Developer
... a config error when running npm run dev coming from next.config.js and ... 'react-square-web-payments-sdk']) module.exports = withTM({ ...
Read more >
Using Next.js with Expo for Web
Next.js can only be used with Expo for web, this doesn't provide Server-Side ... object with the image method and the Expo method...
Read more >
How to set up Next.js into the existing Expo project - Medium
It generates static Next.js files into your project. .next/ pages/ next.config.js ... If we'll try to invoke yarn next dev to run the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found