Skip to content

Webpack fails to resolve scss files imported by other scss files in node_modules #159

@ethanroday

Description

@ethanroday

Steps to reproduce:

  1. Run preact create <app-name>
  2. cd <app-name>
  3. npm install --D material-web-components
  4. In a .scss file, include @import "~@material/drawer/mdc-drawer"; to import the styles for the Material drawer.
  5. npm run build

Expected result:

The build will succeed.

Actual result:

The build fails. It turns out that @material/drawer/mdc-drawer is dependent on @material/rtl/mixins but, since that import isn't prefixed by a ~, Webpack doesn't know where to find it.
A quick fix (although probably not the most efficient fix) is to just tell sass-loader (and less-loader) to look in node_modules to resolve imports. I will do a quick PR if that seems like the right solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions