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

What could be causing the issue when trying to use Puppeteer on Ubuntu version 18.04.4 LTS?

When running Puppeteer with the same configuration, everything works smoothly until deployment on an ubuntu VPS where I encounter the following error: internal/util.js:209 throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original ...

Guide to linking two variables in Vue.js

I'm working on a project that combines Laravel with Vue. Right now, I'm passing data from the controller to the view in two variables - users and user_data. How can I link these two variables together and display them using v-for? These two tabl ...

Element enclosed within a territory of mongoose Schema

In the midst of developing an API that provides detailed information about laptops, I am utilizing Node.js and MongoDB with Mongoose. The schema I am working with is as follows: const productSchema = mongoose.Schema( { name: { type: String, ...

Last item in Material UI Grid container not filling up entire space

I designed a Grid container with 2 Grid columns, each containing 3 elements. However, I am facing an issue where the last element of each column is not appearing at the bottom as intended. What could be causing this problem? For reference, you can view th ...

What is the process for integrating the node-menu package into my project without utilizing the require statement?

Is there a way to incorporate node-menu into my TypeScript project without using require, like this: const menu = require('node-menu'); Whenever I attempt to import node-menu into my project, I encounter the following errors: ...

Vue.js watcher fails to observe changes in v-model

I'm encountering an issue with vue.js. I have set it up so that when a new item is added, it is saved to local storage. However, I also want the item to be saved to local storage when editing it in the input field. I thought this should work because o ...

creating a form layout with inline buttons

I have encountered an issue with aligning 2 buttons and a form with input type in a single line. Even though I have tried different approaches, I am unable to achieve the desired inline layout. Here is my current setup: .btn-registerLayout { backgr ...

Having trouble compiling your Vue project and running into the "No mixed spaces and tabs" error?

Below are the details with an error: Error Details: Failed to compile. ./src/components/Header.vue Module Error (from ./node_modules/eslint-loader/index.js): H:\project\VueProjects\stock-trader\src\components\Header.vue 27: ...

Having difficulty installing npm due to version issues while working with Vue

What steps should I take to troubleshoot this issue? PS C:\xampp\htdocs\MOA\agri-app> npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/em ...

Node js Express js token authentication: unraveling the implementation complexities

After extensive research on authentication methods for nodejs and express js, I find myself at a crossroads. So far, the most helpful tutorial I've found on sessions is this one. I am working with the mean stack and my main goal is to provide users ...

What is a more definitive way to define a variable other than using const?

One of my components, called NoteComponent, emits a message called note-not-saved. To handle this message, I have the following code: <template> (...) <NoteComponent @note-not-saved='() => noteNotSaved=true' /> (...) </templ ...

Tips for achieving a seamless page transition using Vuetify

I'm a beginner with Vue/Vuetify and I have a question regarding page transition/rendering upon cache refresh in Chrome: As an example, I added a small code snippet to my project here: codepen.io/vreaxe/pen/oeWwOJ. After performing a cache-refres ...

Adjusting the width of an image in Safari

I just launched my website, but I encountered an issue with the image size in Safari. In my CSS, I set the width like this: img { width: 450%; } Here is the site: I can't figure out why the images display correctly in Chrome and Mozilla, but ...

Centering Vertical Tabs Using HTML and CSS

I followed a vertical tab tutorial on W3Schools and would like to implement it on my website. However, I am having trouble centering the tabs after reducing their width sizes. I have attempted adding div tags to the code and aligning them to the center wit ...

What is the reason the text does not have a border around it?

The border is supposed to be around the text, but it isn't showing up. Where did I go wrong? Could it be that I need to set a position? html { width: 100%; height: 100%; margin: 0; padding: 0; } body { width: 100%; height: 100%; marg ...

Issue: A default engine was not specified and an extension was not provided (Utilizing ExpressJs and nunjucks)

I have been working with Nunjucks templating engine in Express js. The page renders correctly, but I am encountering an error in the console. Error: No default engine was specified and no extension was provided. Source: Nunjucks documentation var app = ...

How can I utilize a prop in Vue to dynamically assign a CSS class?

I recently started using a pagination library called Vue Ads Pagination and encountered an issue with the VueAdsPageButton component. It has a hidden prop named active, which is a boolean value indicating whether the button is active or not. My goal is to ...

Transmitting FormData via 2 API endpoints in NextJS

As I'm sending formdata, which includes images, to my backend, I've discovered a way to further secure it by utilizing the NextJS API. This involves making calls from the client to the NextJS server/api, with NextJS acting as an intermediary to s ...

Invoke a Node.js script from a Spring Boot application to pass a Java object to the script. The script will modify the object and then return it back to the originating class

class Services { Address address = new Address(....); /* Invoke NodeJs script and pass address object In the js script modify address object var address = getAddress() Modify address object Return address obj ...

Should you include the dollar sign in a Vue HTML variable or not?

I’m a bit confused about whether or not I should include $ when using a Vue HTML variable: new Vue({ data: { a: "myData" } }); Do I need to use: <h1>My value is {{ a }}</h1> or <h1>My value is {{ $a }}</h1> What ...