how to use sass using in vuejs3/vite

Vite is a litte bit different import { defineConfig } from ‘vite’ export default defineConfig({ css: { preprocessorOptions: { scss: { additionalData: ` @import “./src/styles/_animations.scss”; @import “./src/styles/_variables.scss”; @import “./src/styles/_mixins.scss”; @import “./src/styles/_helpers.scss”; ` } } } })

vue component doesn’t update after state changes in pinia store

storeToRefs() You need to use storeToRefs() to extract properties from the store while keeping those properties reactive. import { storeToRefs } from ‘pinia’ const themeStore = useThemeStore(); const { isDark } = storeToRefs(themeStore); Computed property Thanks to @Fennec for suggesting the computed way of getting reactive state. Although I don’t recommend this method since there … Read more

Bundle JS and CSS into single file with Vite

Two steps, We can inject css into js assets with vite-plugin-css-injected-by-js. We can emit a single js asset by disabling chunks in rollup’s config. Final result, import cssInjectedByJsPlugin from “vite-plugin-css-injected-by-js”; export default defineConfig({ plugins: [cssInjectedByJsPlugin()], build: { rollupOptions: { output: { manualChunks: undefined, }, }, }, }); As suggested by @TheRockerRush below, you may want … Read more

Is there any bundle analyzer for vite?

Alternatively, you can use vite-bundle-visualizer, which uses rollup-plugin-visualizer: npx vite-bundle-visualizer Usage # In your vite project’s root $ npx vite-bundle-visualizer # Then open stats.html in browser $ npx vite-bundle-visualizer –help vite-bundle-visualizer Usage: $ vite-bundle-visualizer <command> [options] Options: –template -t <template> Template to use, options are “raw-data” (JSON), “treemap”, “list” (YAML), “sunburst” and “network” (default: treemap) … Read more

Using Vite for backend

You can try vite-plugin-node. This vite plugin supports multiple nodejs frameworks out of the box including koa. I have created a simple express app with it in typescript which worked fine for me. One downside is the plugin is fairly new and still in its early stage, so you may not want to use it … Read more