fast-sass-loader icon indicating copy to clipboard operation
fast-sass-loader copied to clipboard

@import sytax can not be correct resolved on Windows 10 System.

Open Here21 opened this issue 6 years ago • 2 comments

Description

When I use fast-sass-loader in react project. It was well on my Mac. But when I try run this project on Windows 10 device, it can not pass the compile.

The Webpack throw a error message about "Module build failed.... Error : Import file cannot be resolved : @import '~src/styles/vars.scss' "...

image

image

Code

webpack config:

...json
// webpack.config
"alias": {
    "src": "./src" // ignore the short path, it will be resolved correctly.
}
@import '~src/styles.vars.scss';

Environment

  • fast-sass-load: @1.5.0
  • webpack 4.x
  • windows 10

Here21 avatar Nov 21 '19 07:11 Here21

同样的问题

lxzy-yun avatar Aug 28 '20 05:08 lxzy-yun

For me, replacing imports[i] with imports[i].replace(/\\/g, "/") at https://github.com/yibn2008/fast-sass-loader/blob/master/lib/index.js#L205 (parameter to loaderUtils.urlToRequest(...)) works as a dirty-fix. I'm not gonna spend time to work out a clean solution for a PR though.

xoria-dev avatar Oct 19 '21 12:10 xoria-dev