Error: Unable to locate or read the file "style.scss" for import

I'm currently in the process of setting up a new vuejs project from scratch, but I've encountered an error when trying to import "style.scss" into my component. Specifically, the issue arises in the Login.vue file where I include the style.scss.

<template>
    <div class="container">
        <div class="card">
            <h1>This is the login page</h1>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Login"
    };
</script>

<style lang="scss">
    @import 'style.scss';
</style>

In terms of file structure, style.scss can be found under /src, while the Login.vue component is located within /src/views:

https://i.sstatic.net/elXil.png

Despite multiple attempts, including changing the import statement to:

@import '/style.scss';    //and
@import '../style.scss';

Unfortunately, the problem persists. Here's a glimpse at my webpack configuration for sass-loader:

{
    test: /\.scss$/,
    use: [
        'vue-style-loader',
        'css-loader',
        'sass-loader'
    ]
}

Answer №1

Make sure to use the correct file name which is "styles", not "style".

You can try using one of the following file path options mentioned above. Either @import '/styles.scss'; or @import '../styles.scss'; should be suitable for your needs.

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

**Finding the Index of a Table Row in Vue-Tables-2**

Recently, I came across some vue code that utilizes vue-tables-2. The table in question is quite simple and looks like this... <v-client-table :data="myRows" :columns="columns" :options="options"> <div slot=" ...

Using Jquery variables for calculations and they do not work with numerical values

Hey there, I'm new to this so bear with me. I have a jQuery question that's puzzling me... I'm attempting to set the line height using the following method: var line_height = $('.container').css("height"); console.log(line_height ...

Exploring the power of Bootstrap 5 for vertical alignment

I am currently utilizing the flexbox grid from Bootstrap 5 to create a mobile-first Angular web application that is responsive. For the home screen of my app, I want to incorporate these 3 elements : The title of the app displayed at the top A series of ...

Prevent the click event from passing down to the child component in Vue 2

After including the following HTML structure: <div @click='handleClickOnDiv'> {{ message }} <i class='fa fa-plus' @click.stop='handleClickOnI'></i> </div> When clicking on the div, it triggers ...

Unusual Box-shadow glitch experienced exclusively when scrolling in Chrome 51

While working on my website, I encountered a peculiar issue with the box-shadow in Chrome 51. My site has a fixed header with a box-shadow, but when I scroll up or down, the box-shadow leaves behind some marks (horizontal gray lines): https://i.stack.imgu ...

Tips for positioning a text link alongside an image link within a table row using only inline styles

I am struggling to align text and an image link next to each other within a table row. The image keeps moving up and down despite my efforts to use various alignment and display block styles. I am only able to use inline CSS and need it to display correctl ...

Creating a reactive provide/inject system involves utilizing the Vue Composition API to

Important notes: Vue.js 2 and Composition API In the following code snippet, the parent component provides the value for the reactive variable status. The value of status is updated at specific intervals within the mounted lifecycle callback function. Th ...

Avoid risky assigning value of type `any`

Currently, I am incorporating TypeScript into my client-side application. However, upon running the application, I encounter two specific errors: @typescript-eslint/no-unsafe-assignment: Unsafe assignment of an `any` value. @typescript-eslint/no-unsafe-me ...

CSS: Struggling to properly position two flex items

I'm having some trouble with the alignment in my flex container. The title is perfectly centered, but the breadcrumb content is not aligning correctly. Specifically, I want the breadcrumbs to be right-aligned and positioned 25px from the top within t ...

Editable Vue template that can be customized by the user

I have implemented a feature in my application where users can customize templates for different functionalities such as Invoices, Emails, etc. I want to allow the user to edit these templates by simply dragging and dropping elements. Currently, I am using ...

Retrieve props in a Vue component using the available context

As a newcomer to the VUE world, I have begun creating an app to display a list of TODO's. Passing the todo items through props to the todo component felt like the right approach, but I found myself searching for a more efficient way to share props wit ...

ul background transparency only works with absolute positioning if using a Transparent PNG

Encountering a strange issue was the order of the day, as I found myself faced with an unordered list featuring a background image in the form of a semi-transparent PNG. To my surprise, the transparency only became visible once I designated the unordered l ...

Unlock the power of Component level CSS in NextJS with this simple guide!

I don't have much experience with CSS, as I rarely write it these days due to the popularity of libraries like MUI. However, I recently found myself in a tricky situation where I needed to rewrite this example Emabla carousel in typescript and NextJS. ...

I want to display a div above an image when hovering over it

.vpbutton {padding:4px;background-color:#EFEFEF;} .userbox img{padding:8px;background-color:#EFEFEF;} .userbox img:hover{opacity:.2;} <div class="userbox"> <img src='img.png' style='height:120px;width:120px;border:1p ...

One page experiences issues loading CSS due to MIME type, while a different page has no problem with it

I'm facing an issue with my express app that renders Mustache templates. The problem is related to the CSS not applying on one of the routes due to it being of MIME type text/html (as mentioned in the Chrome console). This is how I set up my express ...

Break the page after generating specific charts with JQuery

I have a task to create multiple charts, where the first page needs to include a header and the first 8 charts. How can I insert a page break after the 8th chart and move on to a second page without a header? Each student has different subjects and score ...

Unable to retrieve a state property within a Vue template

Embarking on my Vue journey, I've been immersing myself in online videos to grasp the essence of this framework. One intriguing observation that has piqued my curiosity is the difference in behavior when I switch from a template to a render function i ...

Utilizing SCSS to implement custom animations according to specific element IDs

How can I add different animations based on the ID of two DIVs with the same class when clicked? JSX: <div className="card"> <div id="front" className={frontClasses.join(' ')} onClick={clickedFront}> OPEN ...

Guide on aligning a series of divs in a single row within a parent div

Within the confines of a 400px wide div called "container", there are six left-floated "box" divs, each 100px wide. The combined width of the "box" divs exceeds 400px, resulting in the divs wrapping onto two lines, with 4 on the first and 2 on the second ...

What is the best way to update a Vue variable when the corresponding API variable has

I am looking to integrate VUE with Pano2VR. Pano2VR provides an API () that enables me to retrieve a variable value from Pano2VR and use it in Vue. I have written code that successfully retrieves the variable value from Pano2VR and assigns it to Vue. Whe ...