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.

next.config.js module export error

See original GitHub issue

I have the following code in my next.config.js and it currently works

const nextTranslate = require("next-translate")

module.exports = nextTranslate

When i try to change module.exports = nextTranslate to module.exports = nextTranslate(), I get the following typescript error:

This expression is not callable. Type ‘typeof import(“D:/test/node_modules/next-translate/index”)’ has no call signatures.ts(2349)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
aralrocacommented, Feb 15, 2022

Thank you for the reproduction repository! If you read the Error message after yarn dev, is saying that you miss the i18n file.

In reality you miss 2 things:

i18n.json file:

{
  "locales": ["en", "ca", "es"],
  "defaultLocale": "en",
  "pages": {
    "*": ["common"],
    "/": ["home", "example"],
    "/about": ["about"]
  }
}

locales:

.
├── ca
│   ├── common.json
│   └── home.json
├── en
│   ├── common.json
│   └── home.json
└── es
    ├── common.json
    └── home.json

More details in the documentation.

0reactions
mkbctrlcommented, Aug 25, 2022

I have the same issue. Just wanted to set things up.

I did the following steps:

  1. install package
  2. add config
  3. add locales
  4. update next config

Translations work but the error is present. Reseting VScode settings doesn’t help

Read more comments on GitHub >

github_iconTop Results From Across the Web

next.config.js module export error · Issue #780 - GitHub
I have the following code in my next.config.js and it currently works const nextTranslate = require("next-translate") module.exports ...
Read more >
next.config.js: Introduction
next.config.js is a regular Node.js module, not a JSON file. ... NextConfig} */ const nextConfig = { /* config options here */ }...
Read more >
I have an error while customizing my default next config js file ...
Two things. The first export ist correct, you just have a typo. But you are defining the export again. You can just have...
Read more >
Error: Failed to load next.config.js - Square Developer
I'm getting a config error when running npm run dev coming from next.config.js and can't figure out what's causing it.…
Read more >
Next.js + Webpack - Fix for ModuleNotFoundError: Module not ...
To fix the error with Webpack 5, update your Next.js config file ( /next.config.js ) with the following, it tells webpack not to...
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