Is it a manual install or with a starter kit? I mean inertia.
Using SCSS with Jetstream Inertia
I'm sort of stumped trying to figure out how to use <style lang="scss"> in my Vue components. I'm working in Laravel 8 Jetstream Inertia and followed the instructions at https://vue-loader.vuejs.org/guide/pre-processors.html#sass. But when I run npm run dev it throws an ugly error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: expected "{".
SFC
<template> ... </template>
<script> ... </script>
<style lang="scss">
$color-green: #29a634;
body { background-color: $color-green; }
</style>
webpack.config.js
const path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
}
]
},
resolve: {
alias: {
'@': path.resolve('resources/js'),
},
},
};
npm ls
├── @inertiajs/[email protected]
├── @inertiajs/[email protected]
├── @inertiajs/[email protected]
├── @tailwindcss/[email protected]
├── @tailwindcss/[email protected]
├── @vue/[email protected]
├── @vueform/[email protected]
├── @vueform/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Any advice would be greatly appreciated!
I have tested at my end, using fresh installation Laravel and jetstream + inertia
All you need to do is executing the below command, rerun the command npm run dev.
npm install sass-loader sass webpack --save-dev
https://webpack.js.org/loaders/sass-loader/
Remove the custom config rules you added for SASS/SCSS. Webpacker 6 will provide the appropriate CSS rules for you
Please or to participate in this conversation.