Solving dependencies for npm modules

I have a project where I am utilizing a custom library to share Vue components across various applications.

To achieve this, I have added my component library as an npm module and included it in the application's package.json file, which is functioning correctly.

However, I am encountering an issue when trying to import a specific component within the library into a single component. The application fails to resolve the dependencies of that component.

For example, in the component library:

<template>
    <!-- my html -->
</template>
</script>
    // my script
</script>

<style scoped>
// here I import the basic style for the component:
@import "../../assets/base";

In the application's package.json file, I have:

"components": "git+ssh://<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c6b65784c6b6578227474747474226f6361">[email protected]</a>:xxxxx/xxxxx/my-library.git#development",

Subsequently, I use the component in my project like this:

import MyComponent from "./components/MyComponent.vue";

The component library functions properly, but upon importing the component into the application, webpack throws the following error:

This dependency was not found:

* -!../../../../css-loader/index.js?sourceMap!../../assets/base in ./~/css-loader?sourceMap!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-28803148","scoped":true,"hasInlineConfig":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./~/components/src/core/MyComponent.vue
To install it, you can run: npm install --save -!../../../../css-loader/index.js?sourceMap!../../assets/base

Replacing the @import statement with the actual CSS needed resolves the issue. How can I configure this setup to function correctly?

Answer №1

Apologies, the mistake was as easy as forgetting to include lang="scss" in the style declaration of the component:

  <style scoped>

it should read as follows:

  <style scoped lang="scss">

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

Promise and Determination failing to produce results

const { GraphQLServer } = require('graphql-yoga'); const mongoose = require('mongoose'); mongoose.connect("mongodb://localhost/test1"); const Todo = mongoose.model('Todo',{ text: String, complete: Boolean }); const ...

Retrieving information from a dynamically generated HTML table using PHP

I have successfully implemented functionality using JavaScript to dynamically add new rows to a table. However, I am facing a challenge in accessing the data from these dynamically created rows in PHP for database insertion. Below, you will find the HTML ...

CSS animations - transitioning opacity in and out

Looking to add some CSS animations to a menu but running into some issues. I've got the code below for the menu to fade in on hover, but can't quite figure out how to make it fade out smoothly as well. I've tried a few approaches, but all I ...

How do I initiate PUT and DELETE requests from my HTML code?

I am currently in the process of developing a web application that will manage items within a list. Previously, I used buttons with event listeners and JavaScript functions to handle editing and deleting items. However, I am now transitioning towards build ...

Exploring methods for verifying JWT login in a Node.js application using Express

My current project involves setting up a login route for my API, and I've outlined the algorithm that needs to be followed: The first step is to verify if the user exists in the database (if not found, send a 404 error). Next, I need to check if the ...

Is there a way to broadcast a message to all the Discord servers where my bot is currently active using v14 of discord.js?

Can someone assist me in creating code that allows me to send a message to all servers at my discretion? I have not found any resources on this topic for discord.py or the newer versions of discord.js ...

Tips for positioning elements within an ng-repeat list using absolute positioning?

Here is the HTML code: <div class = "container"> <form ng-submit = "createSticky()"> <input ng-model="formData.data" type="textarea" name="sticky_content" placeholder="add sticky text" required="true"/> <input ng-model= ...

Transforming segments into divisions

I recently designed a website using sections instead of divs in order to achieve the desired alignment of the divs within the same container. However, I am facing difficulties and confusion in implementing this approach. Currently, my divs collapse on top ...

Unable to find component: "wrestler-choice-box". If this is a built-in custom element, please ensure it is not included in component resolution

In my attempt to achieve a specific goal, I have an array of data that I want to incorporate into my HTML document along with a Vue component containing a template. My intention is to utilize list rendering so that the names and images from this array bind ...

How do I retrieve the host name of a webpage in server-side rendering using Nuxt.js?

Within my Nuxt.js project, I have a configuration variable for the API environment structured as follows: [ { front_host: local-1.domain.com, backend_api: api-1.domain.com }, { front_host: local-2.domain.com, backend_api: api-2.domain.com }, ] I ...

The error message that reads "global.util.crypto.lib.randomBytes is not recognized as a function

I'm a newcomer to the world of React and I've encountered an issue while using the npm package amazon-cognito-identity-js. The error message that's plaguing me is: _global.util.crypto.lib.randomBytes is not a function Here's a snippet ...

Is it possible to implement navigation guards with file boot in Quasar framework?

Recently, I created a registration app to test login, register, and navigation guards. However, I am facing an issue where I can always open the link. Below are the codes that I have used: const routes = [ { path: '/', component: () ...

Building with bricks and mortar does not involve organizing visual content

I'm currently trying to organize some fairly large images using masonry, but the code below doesn't seem to be working. I'm using node.js with express and have installed the masonryjs package in an attempt to make it work, but that approach ...

Alter the border line's color based on the specific section or div it overlays

I am attempting to utilize jQuery in order to change the color of my border line depending on its position within the divs. I have set the position to absolute and it is positioned on both divs. My goal is to make the line on the top div appear as grey, wh ...

Need help resolving this issue? (node:4) UnhandledPromiseRejectionWarning: Error: ETELEGRAM: 400 Bad Request: unable to locate chat

Setting up a telegram bot and encountering an error after entering all the data. Attempting to reload. Confusion about where to insert a specific code fragment - perhaps here. An issue occurred while trying to input the code. Error in getChatMember { E ...

Page Not Found: Troubleshooting Express Server Issue

Currently, I am working on creating a basic parser using Node/Express and Cheerio. However, even though the server is running smoothly, I am unable to load any pages in my browser. Below is the code snippet from server.js: var express = require('expr ...

I am having trouble getting the border-radius to display properly in my email table

I'm in the process of designing a responsive email template. For the white content area, I've applied border-radius: 5px;. While it's working fine on the bottom corners of the table, the top corners don't seem to display the border-rad ...

After deployment, certain formatting elements appear to be skewed in the React application

After developing a React app with create-react-app, everything was working perfectly. However, upon deployment, I noticed that some styles weren't showing up as expected. The majority of the styling from Material UI is intact, but there are a few dis ...

To ensure optimal performance, it is necessary to import the vite build styles individually

I created a vue3+vite package and now I am looking to publish it on npm. However, when I import it into a test project, I find myself having to separately import styles from the dist folder in addition to the package itself. My goal is for the styles to be ...

Problem connecting Docker container with Vue Vite

Hello, I recently installed a fresh Vue3 TypeScript + Vite app. However, I am facing an issue after building the image and spinning up the container. I am unable to access localhost:3000 as the browser displays: The connection was reset docker run --rm ...