Vuetify build fails on a Sass variable that is not configurable
Error: This variable was not declared with !default in the @used module.Short answer
Sass lets you change a module's variables through @use ... with only when that module declares each one with !default. A name that does not exist, or one the module sets without !default, stops the build. Configure Vuetify through the plugin's styles.configFile and override only variables Vuetify exposes.
Fix it fast
1Find out which cause you have
The error points at one line in your own settings file. Read the variable name on that line and compare it with how it is set up: is it inside the configFile, and does Vuetify define it?
grep -rn "vuetify/settings\|configFile" src vite.config.*2Match what you see, then jump to its fix
- 1
The error names a variable from your @use 'vuetify/settings' with ( ... ) blockThe variable you override is not declared with !default by VuetifyFix - 2
Overrides are in a separate file that is also imported by hand from components or stylesThe settings file is not wired through the plugin's configFileFix
- 1
What does the error look like?
Error: This variable was not declared with !default in the @used module.@use 'vuetify/settings' with (
Cause 1 of 2
The variable you override is not declared with !default by Vuetify
1Check
Sass's rules for @use ... with say the variable must exist in the module and must carry the !default flag. A typo, a variable from another Vuetify version, or a value Vuetify sets without !default all fail the same way.
grep -n "with (" -A8 src/styles/settings.scss2Fix
Remove the entry, or rename it to a variable Vuetify lists as configurable in its SASS variables guide. Keep the block as the guide shows it.
// src/styles/settings.scss
@use 'vuetify/settings' with (
$body-font-family: ('Inter', sans-serif),
);3Verify
Restart the dev server and run a production build.
npm run buildConfirmed by raw.githubusercontent.com
Cause 2 of 2
The settings file is not wired through the plugin's configFile
1Check
Sass allows configuring a module only once, the first time it loads. If Vuetify's styles load before your settings, a later 'with' cannot configure it.
grep -n "vuetify(" -A6 vite.config.*2Fix
Point the plugin at the settings file so it is loaded before each Vuetify stylesheet, and stop importing Vuetify settings elsewhere. In Sass files use 'vuetify/settings', not 'vuetify/styles', which resolves to precompiled CSS.
// vite.config.js
vuetify({
styles: { configFile: 'src/styles/settings.scss' },
})3Verify
Start the dev server and check the page uses your override.
npm run devConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Change Vuetify variables only in the one configFile and nowhere else.
- After a Vuetify upgrade, check each overridden variable name against the SASS variables guide for that version.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Qist BazaarA buy-now-pay-later marketplace built from a blank repo, now past 100K downloads on Google Play.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Web apps
Flutter web warns that webOnlyWarmupEngine and webOnlySetPluginHandler are deprecated
Please use `bootstrapEngine` from `dart:ui_web` instead.
Flutter's web engine marks webOnlyWarmupEngine and webOnlySetPluginHandler in dart:ui as deprecated.
2 causes, each with a fixWeb apps
Dart Sass warns that the legacy JS API will be removed
Warning appears on every build after updating sass to 1.79.0 or newer
The warning means a tool in your build still calls Dart Sass through its old render or renderSync functions.
2 causes, each with a fixWeb apps
Sass says a mixin is undefined although the file defines it
Module build failed (from ./node_modules/sass-loader/dist/cjs.js)
Sass only sees a mixin that the current file loads.
4 causes, each with a fixWeb apps
tsconfig rejects allowImportingTsExtensions
An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly
allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.
2 causes, each with a fixWeb apps
AuthUserPoolException: Auth UserPool not configured in a Next.js app
Auth UserPool not configured
The error means an Amplify Auth call ran before Amplify.configure did.
3 causes, each with a fixWeb apps
Module not found for antd/dist/antd.less after upgrading to Ant Design 5
Module not found: Error: Can't resolve 'antd/dist/antd.less'
Ant Design 5 dropped Less and the bundled CSS file for CSS-in-JS, so antd/dist/antd.less no longer exists.
3 causes, each with a fix