vuetify-module
vuetify-module copied to clipboard
Using treeShake with nuxt-vite doesn't work
Vuetify doesn't work when using 'nuxt-vite' and treeShake to be able to modify the sass variables. Without nuxt-vite the app works perfectly
vite uses rollup this module needs webpack for treeshaking.
Maybe my own module https://github.com/EC-Nordbund/vuetify-module works with vite (uses nuxt components module for treeshaking). I did not test that.
How do we force it to use variables.scss
then?
vite uses rollup this module needs webpack for treeshaking.
Maybe my own module https://github.com/EC-Nordbund/vuetify-module works with vite (uses nuxt components module for treeshaking). I did not test that.
Can confirm that @mathe42's module works in-place of the vuetify module, for use with vite and treeShake: true
. The startup time is significant but vite's hot module reloading works as fast as usual with both components and styles, and with a small delay (8 seconds for me) when changing the variables.
As an addendum to getting it fully working; I had to switch from 'scss' to 'sass' (presumably using the loader that works to merge the variables)
vite: {
// ...
css: {
preprocessorOptions: {
sass: {
additionalData: '\n@import "./assets/styles/variables.scss"\n',
},
},
},
},
And I had to configure the EC-Nordbund/vuetify-module
to load all of the mdi icons, as such:
iconFont: 'mdi',
iconInjector: false, // Load full mdi-icon set, see https://github.com/EC-Nordbund/vuetify-module