本人总结了一套万能无错的版本

node 8.11.2
sass-loader 7.3.1
node-sass 4.7.2

node版本对应的node-sass
node版本对应

sass-loader 4.1.1,node-sass 4.3.0
sass-loader 7.0.3,node-sass 4.7.2
sass-loader 7.3.1,node-sass 4.7.2
sass-loader 7.3.1,node-sass 4.14.1

使用国内镜像

npm install -g mirror-config-china --registry=http://registry.npm.taobao.org

安装对应版本

npm uninstall node-sass sass-loader
npm install sass-loader@版本号 node-sass@版本号  --save-dev

在vue.config.js配置

module.exports = {
    css: {
        loaderOptions: {
            sass: {
                // 全局sass变量	
                //sass-loader 8.0.0以前版本(包含)
                prependData: `@import "~@/assets/scss/index.scss";`
            }
        }
    },
}

module.exports = {
    css: {
        loaderOptions: {
            sass: {
                // 全局sass变量	
                //sass-loader10 新版本
                additionalData: `@import "~@/assets/scss/index.scss";`
            }
        }
    },
}

GitHub 加速计划 / no / node-sass
8.5 K
1.33 K
下载
:rainbow: Node.js bindings to libsass
最近提交(Master分支:2 个月前 )
6081731a Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> 9 个月前
62c0f46c Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> 9 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐