Skip to content

ModuleNotFoundError when using sass @import in combination with css modules #2334

Open
@dattn

Description

@dattn

Version

3.0.0-rc.11 - 3.0.5

Reproduction link

https://github.com/dattn/vue-cli-bug-demo

Node and OS info

Node v10.9.0 / Ubuntu 18.04

Steps to reproduce

npm install
npm run build

What is expected?

The scss files should be imported with Sass.
The code should build successfully.

What is actually happening?

The relative scss files cannot be found.
The build fails with the following error message:

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleNotFoundError: Module not found: Error: Can't resolve './variables'

With vue-cli v3.0.0-rc.10, the code builds as expected.
The problem exists as of version 3.0.0-rc.11. The latest version 3.0.5 also fails.

I think the source of the problem is the following commit:
4220835

When I add the following props to the vue.config.js, the build works again:

module.exports = {
  css: {
    loaderOptions: {
      css: { importLoaders: 3 }
    }
  }
}

Related issue: #2055

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions