The Monorepo encountered an issue with parsing the module in NextJS 13 combined with Typescript, resulting in

Currently, I am in the process of transferring a functional nextjs 13 app to a single monorepo. I started by creating a new repository using npx create-turbo@latest and then relocating my existing repository (let's call it "frontend") to the apps/ directory. Afterward, I included the 'ui' dependency in the apps/frontend/package.json file:

{
    "name": "frontend",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        ...
        "ui": "*",
    }
    ...
}

I also added the transpile option in the next.config.js file:

experimental: {
    transpilePackages: ['ui'],
}

Initially, everything seemed to be functioning correctly. However, when I moved a component from my existing project to the UI folder, included all necessary dependencies, and attempted to run it, I encountered the following error:

frontend:dev: error - ../../packages/ui/Button/Button.tsx
frontend:dev: Module parse failed: The keyword 'interface' is reserved (11:0)
frontend:dev: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
frontend:dev: | import classNames from 'classnames';

Is there a configuration setting that I may have overlooked?

Environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000
Binaries:
  Node: 16.13.2
  npm: 8.1.2
  Yarn: 1.22.19
  pnpm: N/A
Relevant packages:
  next: 13.0.4
  eslint-config-next: 12.3.4
  react: 18.2.0
  react-dom: 18.2.0

Answer №1

If you are encountering the same problem, I have a solution. The reason for the issue was my mistake in using npx create-turbo@latest to set up the initial monorepo. I forgot to upgrade to next13 in my existing project after transferring it.

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

Error in React Native Typescript: The type 'string' cannot be assigned to the type '"solid" | "clear" | "outline"'. (Error code: ts(2322))

I have integrated TypeScript with React Native in my project. import React from 'react'; import { Button } from 'react-native-elements'; import { IThemedButton } from '../../../models/themedButton'; interface IThemedButtonPr ...

Limit the allowable React Component prop type in Typescript

To promote composition within our codebase, we utilize passing components as props. Is there a way to enforce type checking for the components passed as props? For instance, let's consider a commonly used Typography component throughout the codebase, ...

Enhance your React Typescript High Order Component by incorporating additional properties and implementing them

I am in the process of creating a React HOC with specific requirements: It should take a component as input, modify the hidden property (or add it if necessary), and then return the updated component The rendered component should not display anything whe ...

Encountering Problems when Converting Vue Application from JavaScript to TypeScript with Vue and Typescript

Currently, I am in the process of converting a Vue project from JavaScript to TypeScript without utilizing the class-style syntax. These are the steps I took: I ran: vue add typescript I went through all my .vue files and: Indicated that TypeScript ...

Typical approach to receiving a transformed object from an HTTP service

One of the services I provide includes a method with the following implementation: public fetchCrawls(page: number): Observable<ICrawl[]>{ return this._http.get(this._crawlsURL + page) .map((res: Response) => { ...

Starting a Nextjs application with the NewRelic agent: A step-by-step guide

I recently set up the Newrelic agent for my Nextjs application. Here are the steps I have taken so far: npm install @newrelic/next After installation, I copied the newrelic.js file to the root folder and added my license key and app name to it. Furtherm ...

What is the best way to transfer a reference to a server action?

I'm struggling with utilizing server actions to handle form data submission and clearing the form within the action itself. Unfortunately, I'm encountering an issue where the action is not receiving the reference. This is what my action current ...

Uploading Files with Angular 2 using AJAX and Multipart Requests

I am currently working with Angular 2 and Spring MVC. At the moment, I have an Upload component that sends an AJAX request to the Spring backend and receives a response containing parsed data from a .csv file. export class UploadComponent { uploadFile: f ...

Applying Conditional Rendering in React using API Data Retrieval

I'm facing an issue: I need to display only the "nameProcess" and "id" in the table that have the attribute "error = true" in the json file. I've fetched the data but now I'm struggling to implement the condition inside my function. Can an ...

How to Access Data Attribute in React TypeScript on Click Event

Recently, I encountered a situation with my React component where I have a button with a click handler that utilizes the data-* attribute. In the past, with regular React, extracting the value from the data-* attribute was straightforward. However, as I am ...

Unable to retrieve the updated value from the service variable

I'm attempting to implement a filter that allows me to search for items based on a service variable that is updated with user input. However, I am only able to retrieve the initial value from the service in my component. Service HTML (whatever is typ ...

"Adjusting the position of an Ionic Menu on-the-fly

As I strive to update the Ionic 3 Menu side dynamically when the user changes the language, a challenge arises for RTL languages where the menu needs to be on the right instead of the default left. To tackle this issue, I have subscribed to the TranslateS ...

I encountered a problem with iteration where the results appeared perfectly fine, but upon rendering at the component level, the same field loaded with the last object instead

I am facing an issue with rendering the component level when it loads. After clicking on edit and calling the edit function, the data is properly loaded in console and all objects are shown. However, they do not render on the page level. Below is the code ...

Swapping out a class or method throughout an entire TypeScript project

Currently, I am working on a software project built with TypeScript. This project relies on several third-party libraries that are imported through the package.json file. One such library includes a utility class, utilized by other classes within the same ...

Display your StencilJs component in a separate browser window

Looking for a solution to render a chat widget created with stenciljs in a new window using window.open. When the widget icon is clicked, a new window should open displaying the current state while navigating on the website, retaining the styles and functi ...

WebPack Error: When calling __webpack_modules__[moduleId], a TypeError occurs, indicating that it is not a function during development. In production, an Invalid hook call error

Encountering a WebPack error when utilizing my custom library hosted as a package and streamed with NPM Link. Interestingly, the production version functions flawlessly. Below are my scripts: "scripts": { "dev": "rm -rf build ...

Extracting Raw Body from Stripe Webhook in NextJS

I'm feeling frustrated trying to get a raw body passed for the Stripe webhook in NextJS! Despite trying numerous solutions from various sources, I just can't seem to get it to work. Calling upon the developers with special powers (of which I am ...

Conceal a division based on its numerical position

I'm having trouble figuring out how to hide multiple divs based on an index that I receive. The code snippet below hides only the first div with the id "medicalCard", but there could be more than one div with this id. document.getElementById("medical ...

Adding a type declaration to the severity property in React Alert - A guide to Typescript

I've developed a type declaration object for the incoming data, but no matter what I try to define as the type for the property "severity", it's not happy. The options it wants (as displayed below) don't seem feasible. I'm curious if th ...

What could be causing the CSS issue following the recent webpack update?

I've taken on the task of updating an older VUE project with the latest npm packages. I managed to update everything successfully and get webpack to compile without any errors, but for some unknown reason, the CSS is no longer rendering in the browser ...