Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

381
Views
Cannot statically analyse 'require(…, …)' in line 16

I am using nextjs.

When importing markdown-toc in nextjs I am getting the issue. /pages/index.js

import toc from "markdown-toc";

Then I got the below error

./node_modules/markdown-toc/lib/utils.js
Cannot statically analyse 'require(…, …)' in line 16
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When going through the lib code:

'use strict';

/**
 * Module dependencies
 */

var diacritics = require('diacritics-map');
var utils = require('lazy-cache')(require);
var fn = require;
require = utils;

/**
 * Lazily required module dependencies
 */

require('concat-stream', 'concat');

require gets overwritten by the library utils assignment (although it seems like a terrible idea).

I don't know what bundler you use, but this is probably the source of the problem as it tries to evaluate the require with two parameters, which it cannot do.

I would log a Github ticket to use another identifier than require and fix the source of the problem.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!