Learn how to skip creating the tsconfig.json file in Next.js

I have structured my next.js project like this:

site
│  package.json
│  tsconfig.json
│  tslint.json
│  yarn.lock
│
├─dist
│      index.js
│
└─src
       index.ts

However, every time I run next build src, a new tsconfig.json file is generated in the src folder. Since I have already set up TS configuration in the existing tsconfig.json located in the parent directory, I do not want these extra configuration files.

Is there a way to prevent the generation of additional tsconfig.json files during the next.js build process?

  • next.js - 10.0.5
  • typescript- 3.8.3

Answer №1

For optimal results, execute your script with the command next build.

Next.js will conveniently identify the src/ directory upon existence.

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

The path mappings specified in the tsconfig.json file are not resolving correctly during the

Everything runs smoothly with my imports during coding, but after building the project using tsc, the imported files are not resolving to valid paths. This is how my tsconfig.json looks: { "compilerOptions": { "target": "ES2 ...

Allow Visual Studio Code to create a constructor for Typescript class

When developing Angular 2 apps in Typescript using Visual Studio Code, one common task is writing constructors with their parameter list. Is there a way to save time and effort on this? It would be really helpful if the IDE could automatically generate th ...

Encountering an issue while trying to update my ReactJS website on Heroku

When I decided to update my React.JS website hosted on Heroku, I followed a series of steps to make the necessary edits: I initiated the process by running git add ., then continued with git commit -m "make it better", and concluded by executing git push ...

Developing NextJS 13 with App directory integration for socket.io

How do I initialize a socket in the app/api/socket/route.js directory? When referencing the example in the pages/api/socket.js directory, it seems that it does not return an instance of http.ServerResponse. Instead, it returns NextResponse, which does not ...

Is there a way to access a specific argument in yargs using typescript?

The idea behind using yargs is quite appealing. const argv = yargs.options({ env: { alias: 'e', choices: ['dev', 'prod'] as const, demandOption: true, description: 'app environment&apos ...

Unusual behavior observed when routing onScroll in Next.js, with rendering occurring exclusively on the server side

In my attempt to leverage Next.js imperative routing api within a scroll handler for page navigation, I encountered an almost perfect solution by attaching it to the window. However, there is a slight color 'flash' as the scroll position resets w ...

Refining the Union Type of Sets and Arrays for the find function

Here is the data model representation: A person's daily data structure interface FetchDocument { Date : number, Hours : number, } Grouping collection of these data points type Data_Array = Set<FetchDocument> | FetchDocument[] interfac ...

The Angular2 website is failing to update properly when utilizing Angular2-cli

Currently, I am in the process of developing a small Angular2 app and I am using WebStorm to make modifications to a file in order to see the updates reflect in my browser. So far, everything seems to be error-free as I have executed the following command ...

Implementing user authentication with Firebase in a Next.js 13 project

I've implemented an authentication context provider to protect specific pages. Here's how it's set up: 'use client'; import React from 'react'; import { onAuthStateChanged, getAuth, } from 'firebase/auth&apos ...

What is the reason that I am unable to utilize the React and Express libraries from the global space when installed via npm i -g pkgName, yet I am able to use react-scripts from the global space?

Could there be knowledge missing that is preventing this import to work? It seems odd that we can access other globally installed modules like jest, live-server, react-scripts, http-server, but not this one. Any guidance on resolving this issue would be ...

Configuring npm module using environment variables

My current project is structured in a loose ES6 module format with a hard-coded database connection. I am looking to transform this into an npm module and now I am figuring out the best way to allow end users to configure the code. Initially, I tried rewri ...

Guide to Integrating Pendo with Angular 8 and Above

I'm having some trouble setting up Pendo in my Angular 8 application. The documentation provided by Pendo doesn't seem to align with the actual scripts given in my control panel. Additionally, the YouTube tutorials are quite outdated, appearing t ...

I followed the step to download Angular using NPM Install

When attempting to work on a repository that uses Angular without having it installed on my machine, I ran npm i. However, Angular was not automatically installed. So, I had to separately install the Angular CLI before running ng serve --open ...

The error message "command not found" popped up when I tried to run npm with sudo access

After installing nodejs v8.11.2 and npm v5.6.0 with the command nvm install 8.11.2, I encountered an issue upon reopening my system after a period of shutdown. When I entered npm -v in the terminal, it reported that npm was not installed and instructed me ...

Packing the Node application and ensuring that dependencies run smoothly upon unboxing

I recently developed a Node application that depends on Jest for running tests. Now, I want to package this app and its tests to run on another machine with Node installed. In my package.json file, I have the following script: "scripts": { "test": "j ...

Setting up a NextJS development server in a docker environment with networking

Currently, my development environment consists of a NextJS app running in a docker-compose setup under the name frontend. The backend is powered by an expressjs app known as backend. In my NextJS app, there's an environment variable that specifies t ...

Leveraging IF conditions on part of the worksheet title

Currently, my script is performing the task of hiding three columns for tabs in a workbook that start with "TRI". However, the execution speed is quite sluggish. I am seeking suggestions on how to optimize and enhance the performance. If possible, please p ...

When using my recursive type on Window or Element, I encounter a type instantiation error stating "Type instantiation is excessively deep and possibly infinite.ts"

Recently, I have been using a type to automatically mock interface types in Jest tests. However, upon updating TypeScript and Jest to the latest versions, I encountered an error message stating Type instantiation is excessively deep and possibly infinite.t ...

The configuration object is invalid. Angular has initialized Webpack using a configuration object that does not align with the API schema

When attempting to run the angular application with "ng serve -o", I encountered an error message stating "Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema." Prior to this issue, "n ...

Filtering an array does not restrict the type of elements within it

I am facing a scenario where I have an interface containing two optional properties: interface A { one?: string; two?: string; } I want to pass these properties inside an array to a component that specifically requires string[] export const MyComponen ...