Skip to content

dart-sass fails on transitive module imports found in 3rd-party modules #872

@kubijo

Description

@kubijo
  • Operating System: Ubuntu 20.04

  • Node Version: 13.12.0

  • NPM Version: yarn@2.0.0-rc.33.git.20200518.07a15e54

  • webpack Version: 4.44.0

  • sass-loader Version: 9.0.2

Expected Behavior

Not sure what would be the correct solution, but we need a way
to instruct webpack that sass modules imported from node_modules
can import node_modules modules of their own as well.

Actual Behavior

Either of those imports lead to correctly resolved file:

  • @import '~@carbon/type/scss/styles'
  • @import '@carbon/type/scss/_styles.scss'

however in both cases the compilation encounters first import
in that file (@import '@carbon/layout/scss/breakpoint')
and crashes with following attached errors.

sass-loader__transitive-imports

Sidenote

I thought that since version 4 came out following import would work as well,
which would also mean that this error would not exist, but alas I had no luck…

@import '@carbon/type/scss/styles'

Note that the real file, as the screenshot shows, is at:

.yarn/cache/@carbon-type-npm-10.13.0-aebfb3196d-8d86f39f3e.zip/node_modules/@carbon/type/scss/_styles.scss

Is my understanding correct and so is there an error / configuration I am missing?

Code

{
    loader: 'sass-loader',
        options: {
        implementation: require('sass'),
        sassOptions: {
            fiber: require('fibers'),
            sourceMap: !isProduction,
        },
    },
}
@import '~@carbon/type/scss/styles';

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