yibn2008 / fast-sass-loader

High performance sass loader for webpack
250 stars 38 forks source link

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

Open Here21 opened 4 years ago

Here21 commented 4 years ago

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

lxzy-yun commented 4 years ago

同样的问题

ghost commented 3 years ago

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.