Having trouble with Rollup resolving my typings file during the build process

Embarking on the journey of creating my inaugural library, I diligently followed a comprehensive guide. Utilizing rollup to consolidate all components and dependencies.

The conundrum that currently besets me is the perplexing error thrown by rollup regarding the resolution of my typings file. Despite my efforts, the exact cause of this issue eludes me. The error message in question reads as follows:

dist/esm/types/index.d.ts → dist/index.d.ts...
[!] RollupError: Could not resolve "../../../types/typings" from "dist/esm/types/components/CommentBase/interface.d.ts"     
dist/esm/types/components/CommentBase/interface.d.ts
    at error (C:\Users\Yanay\Documents\Coding\replyke\base\node_modules\rollup\dist\shared\rollup.js:284:30)
    at ModuleLoader.handleInvalidResolvedId (C:\Users\Yanay\Documents\Coding\replyke\base\node_modules\rollup\dist\shared\rollup.js:24491:24)
    at C:\Users\Yanay\Documents\Coding\replyke\base\node_modules\rollup\dist\shared\rollup.js:24453:26

This excerpt showcases my package.json configuration:

{
  "name": "@replyke/base",
  "version": "1.0.0",
  "description": "",
  "main": "dist/cjs/index.js",
  "module": "dist/esm/index.js",
  ...

In addition, here is an insight into my rollup.config.js setup:

const resolve = require("@rollup/plugin-node-resolve");
const commonjs = require("@rollup/plugin-commonjs");
const typescript = require("@rollup/plugin-typescript");
const dts = require("rollup-plugin-dts");
const packageJson = require("./package.json");
...

Furthermore, let's delve into my tsconfig.json configuration:

{
  "compilerOptions": {
    "target": "es2016",
    "jsx": "react",
    ...

To add more context, the types/typings.d.ts directory and file are present within my src folder, functioning seamlessly except during the building process with rollup.

Answer №1

Consider adding the external property to your rollup configuration file in order to specifically exclude SCSS and CSS files from type generation.

 {
    input: "dist/esm/types/index.d.ts",
    output: [{ file: "dist/index.d.ts", format: "esm" }],
    plugins: [dts()],
    external: [/\.s?css$/], // instructing rollup to ignore any .css files when generating types
},

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

Leverage the power of a useRef hook to dynamically update a state value within React, even when the object is potentially

I'm running into an issue with the useRef hook, as I'm receiving the error "object is possibly null" when attempting to use it to set a stateful object. const jselectRef = useRef<HTMLButtonElement>(null) const [defaultHeight, setDefaultHeig ...

Execute a pair of scripts specified in the package.json file

Here is my package.json: "scripts": { "dev": "cross-env NODE_ENV=development nodemon src $NODE_DEBUG_OPTION --exec babel-node", "build": "babel src -s -D -d dist", "tsc:w": "tsc -w" } To run my project, I need to execute two commands: np ...

A guide on reducing the size of static assets in a Blazor application

My Blazor Experiment Lately, I've been delving into the world of Blazor. I decided to create a sample application using a Visual Studio template. In an effort to spruce up my application, I stumbled upon a stylish template here. I then proceeded to ...

Removing the @Input decorator in Angular's codebase

I am currently working on an Angular project for a class, and I'm facing an issue where removing the @Input decorator from my component is causing the entire application to not load properly. import { Component, OnInit, Input } from '@angular/ ...

Automate running `npm start` on my NodeJS project directory with a custom Windows Service

After creating a service.js script with the os-service npm package, I was able to successfully install and run it as a Windows Service using the following command on Windows. sc create my-service binPath="\"D:\Program Files\nodejs\node ...

Priority of Typescript TypeRoots

After extending a class from an npm package with additional type definitions, I noticed that my custom definitions are taking lower priority than the ones coming from node_modules. Is there a way to adjust the TypeScript definition priority using the typeR ...

What method can be used to specify a function of any signature that returns a particular type in programming?

I am looking to define a unique type that must be a function which, when executed, will always produce an object containing the property type: string. The input parameters for this function are of no concern. For instance: foo(1, 'bar'); // res ...

A step-by-step guide on leveraging ethereumjs-tx within a web browser

Is it necessary to install npm ethereumjs-tx when utilizing the browser-based version downloaded directly from GitHub? If so, how can we incorporate the ethereumjs-tx module into our script file? It seems like these are two separate components based on ...

Developing personalized commands for terminal using modules

I'm currently developing a node module that is designed to automatically generate all the necessary redux files. The ultimate goal is for the end user to simply run npm install --save redux-file-gen, and then have the ability to execute redux generate ...

Struggling with setting up a search bar for infinite scrolling content

After dedicating a significant amount of time to solving the puzzle of integrating infinite scroll with a search bar in Angular, I encountered an issue. I am currently using Angular 9 and ngx-infinite-scroll for achieving infinity scrolling functionality. ...

A step-by-step guide on setting --max-old-space-size using the npm link command

Can the --max-old-space-size parameter be configured using npm link? I am aware that it can be set using the node command such as node --max-old-space-size=, but I am attempting to achieve the same result through the npm link command. Is this feasible? Yo ...

Issue with LokiJS: The DynamicView().branchResultSet method does not apply sorting to the collection

I'm encountering an issue retrieving data from a branchResultSet after applying the applySort function on the view. I'm utilizing this method to restrict the result set to 10 records for better performance, rather than fetching the entire dataset ...

The Combination of React with TypeScript Icons

Here is an example of an object: const mockDropdown = [{ icon: 'MdMonitor', label: 'Television', }]; When using this component, a warning is displayed: Element implicitly has an 'any' type because expression of type &ap ...

An error was encountered in compiler.js at line 1021, stating that an unexpected value 'UserService' was imported by the module 'UserModule'. It is recommended to add a @NgModule annotation to resolve this issue

As a PHP programmer new to Angular, I am facing an issue while trying to retrieve user properties from a Laravel API. When attempting this, I encountered the following error: compiler.js:1021 Uncaught Error: Unexpected value 'UserService' importe ...

Tips for maintaining the latest HTML, CSS, and JS files in Angular2/4 frontend hosted on IIS

When it comes to IIS, there are various settings that can affect the freshness of files. One setting involves Output Caching, where you can create cache rules such as enabling Kernel-mode caching and utilizing file change notifications. Another sett ...

tsconfig issues with compilation and testing

Here is the configuration in my tsconfig.json { "compilerOptions": { "noImplicitAny": true, "declaration": false, "strict": true, "strictNullChecks": false, "target": "E ...

Programmatically install an NPM package by specifying the version you want to use

I came across a helpful guide on installing npm packages programmatically and successfully tested out the provided code: var npm = require("npm"); npm.load({ loaded: false }, function (err) { // handle errors npm.commands.install(["my", "packages" ...

Is the async pipe the best choice for handling Observables in a polling scenario

The situation at hand: I currently have a service that continuously polls a specific URL every 2 seconds: export class FooDataService { ... public provideFooData() { const interval = Observable.interval(2000).startWith(0); return interval ...

Having trouble locating module './version' - npm installation not working on Azure DevOps platform

Struggling with an issue during the npm install step in my CI/CD pipeline on Azure DevOps. The problematic package seems to be node-sass, which has caused trouble before. Despite previously resolving the issue, builds are now failing again without any cle ...

Issue with building the remix: Intercept Boundary ||= mistake Boundaries. Remix Root Default Grab Boundary

Whenever I try to run the npm run start command, I keep encountering the error catch Boundary ||= error Boundaries.Remix Root Default Catch Boundary;. Even after attempting to recreate the project from scratch, the same error persists. ...