-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SassError: @use rules must be written before any other rules #2997
Comments
Temp workaround: mix.extend('fixSassResourcesLoader', (webpackConfig) => {
const scssRule = webpackConfig.module.rules.find((rule) => {
const { test } = rule;
return test && typeof test.test === 'function' && test.test('.scss');
});
if (!scssRule) return;
scssRule.oneOf.forEach((oneOf) => {
oneOf.use.forEach(({ loader, options}) => {
if (loader === 'sass-resources-loader') {
options.hoistUseStatements = true;
}
});
})
});
mix.fixSassResourcesLoader(); |
thecrypticace
added a commit
to thecrypticace/laravel-mix
that referenced
this issue
Jun 10, 2021
thecrypticace
added a commit
to thecrypticace/laravel-mix
that referenced
this issue
Jun 10, 2021
thecrypticace
added a commit
that referenced
this issue
Jun 10, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Laravel Mix Version: 6.0.19
Node Version : v14.16.0
NPM Version: 6.14.11
OS: macOS 10.15.4
Description:
Error
SassError: @use rules must be written before any other rules
happens because resources loader injects content to the top of each file.Famous issue solved (or not yet) in different resource loaders, for example:
nuxt-modules/style-resources#143
If mix uses
sass-resources-loader
the only needed thing is to enablehoistUseStatements
option.Steps To Reproduce:
Use vue in mix config:
In your vue component use scss
@use
The text was updated successfully, but these errors were encountered: