What is the best way to create sourcemaps in nextjs?

Incorporating Next.js into my application has been a smooth process overall, but I encountered an issue when trying to generate sourcemaps to analyze bundle sizes. Initially, I followed the guidelines provided on Next.js: How to use source-map-explorer with Next.js

However, upon implementation, I received the following error message:

.next/static/chunks/styles.73849dc0d772a52b5056.js
  Unable to find a source map.
  See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps
.next/static/chunks/webpack-2ae0ca3384e062691226.js
  Unable to find a source map.
  See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps
.next/static/chunks/webpack-d9a7914a2067f7938722.js
  Unable to find a source map.
  See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-map

This error seems to be persistent across all of the .js chunks. My attempts to rectify the situation by directly adding code into the module.exports section were hindered due to some plugin constraints. As a workaround, I included the necessary configurations in a separate part of my code:

const nextConfig = {
    productionBrowserSourceMaps: true,
    ...

Furthermore, the module withPlugins that I am utilizing appends the nextConfig at the end of its operations.

  ],
  nextConfig
)

At this point, I'm uncertain if this peculiar setup is causing the issue or if there are other underlying factors contributing to the problem. Any insights or suggestions would be greatly appreciated.

Answer №1

In order to resolve this issue, we made the decision to update to nextjs version 11. Previously, we were using version 10 which was causing problems with generating sourcemaps as per the configuration provided.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Challenges regarding placement and z-index are causing issues

Currently, I am attempting to make the menu overlap the content on my webpage. However, I am facing an issue where it moves the content box instead of overlapping it. I have already experimented with the position: relative concept, but unfortunately, the ...

Trouble with sending arguments to Express middleware

I'm currently working on developing a custom input validation middleware using Express. My aim is to create a middleware that takes 2 parameters in order to validate client input effectively. Despite referencing various sources, including the Express ...

Eliminating the use of undefined values in select dropdown options

My current code reads an uploaded text file and sorts it into options for different <select> elements. However, I'm encountering an issue where once the entire text file is read, additional options appear as undefined. Does anyone know how to pr ...

Removing all hand-drawn shapes on Google Maps

I am currently working on a project that involves using Fusion Tables, but I want to incorporate Event Listeners as well. To achieve this, I am utilizing JSONP technology. In the example provided below (in the fiddle link), you can see both the fusion tab ...

Swapping characters from the beginning and end of a specific string

Consider the following scenario: b*any string here* If this pattern is present, I would like to substitute b* at the beginning with <b>, and the * at the end with </b> (Ignore the backslash for SO site escaping). It's possible that ther ...

Encountering difficulty with displaying a 404 error using Cloud Functions on Firebase Hosting

I am currently facing an issue with handling a custom 404 error using Firebase Hosting and Functions. The code I have provided below works perfectly fine on localhost, but once deployed, Firebase Hosting returns a 500 error instead of the expected 404. ht ...

Surprising results when a class is applied using jQuery

Exploring the differences between two fiddles (make sure to run the code on the jsfiddle pages to see the differences clearly). First Fiddle Simple demonstration: $("body").addClass("noScroll"); alert($("body").hasClass("noScroll")); $("body").removeCla ...

`Cannot press when using custom cursor in JS?`

Hey there! I'm currently working on implementing a custom cursor for specific elements on my website. However, I've encountered a little hiccup - once the custom cursor is in place, I'm no longer able to click on any elements. Does anyone ha ...

Can you show me the method to retrieve the value of client.query in Node JS using PG?

I have been working with node.js to establish a database connection with postgresql. Here is what my dbConfig.js file looks like: var pg = require('pg'); var client = new pg.Client({ host:'myhoost', port:'5432', ...

Executing a Node.Js program that calls a function from a separate file to display a JSON array

Attempting to display a JSON array of all the managers on my localhost results in a blank screen. Despite filling the arrays correctly, it seems like there might be an issue with the server.js file. I'm not exactly sure what's causing the problem ...

Combining two arrays containing objects in JavaScript

Imagine having 2 arrays of objects that you want to merge in a parallel manner. For instance var array = [{foo: 2} , {boo: 3}] var array2 = [{foo2: 2}, {boo2: 4}] The outcome would be var array3 = [{foo:2,foo2:2},{boo:3,boo2:4}] In what way can this be ...

Tips for effectively running multiple XMLHttpRequests in a loop

While running XMLHttpRequest inside .map(), everything operates smoothly. list.map(function(file) { const xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () {} xhr.onerror = function () {} xhr.upload.addEventListener(& ...

remove a specific element from an array

Hey there! I'm attempting to remove only the keys from an array. Here's the initial array: {everyone: "everyone", random: "random", fast response time: "fast response time", less conversations: "less conversatio ...

creating curved lines in three.js

I'm looking for assistance in creating a globe using three.js where I can project arcs representing exports and imports between countries. I have a basic globe set up, but I need guidance on the following: 1. How to use country shape files instead of ...

Step-by-Step Guide on Dividing Table Row Data into Two Distinct Tables

At present, I have created a dynamic table that retrieves data from the database using forms in Django. I'm facing an issue with this table as even though there are 7 columns, only 2 of them are visible. However, all 5 hidden columns do contain impor ...

Navigating to clean URLs using router.push in Next.js

My current code redirects to /home and passes a username variable, but it displays in the address bar as http://localhost:3000/home?username=bobmarley. How can I cleanly pass variables using next.js? import { withRouter } from 'next/router' login ...

Tips for making a Scroll Button

I am in the process of designing a horizontal website and I would like to incorporate two buttons, one on the left and one on the right, that allow users to scroll to the left and right, respectively. You can check out the site I am currently working on h ...

Resolving issues with setting up d3.js in the 'Creating a Custom Map' guide

Starting Mike Bostock's tutorial on creating a map, but facing some installation issues at the beginning. I am using Windows 8.1 for this. This is the specific part that's causing trouble: "To get started, you'll need the reference implemen ...

IE throwing an invalid argument error when making an AJAX request

I have a strange issue with my ajax request - it works perfectly fine in all browsers except for IE, specifically IE10! The error message I am encountering in the IE console is as follows: SCRIPT7002: XMLHttpRequest: Network Error 0x80070057, Invalid arg ...

"Utilize the simplewebauthn TypeScript library in combination with a password manager for enhanced security with passkeys

After using Passkey in TypeScript with the library , I noticed that it saved the passkey in my browser Keychain or Mac Keychain. However, I would like my password manager (such as Dashlane, 1Password, etc.) to save it similar to this site How can I confi ...