It's working most likely. Try to change "browserlists": [ "defaults" ] to something like "browserlists": [ "last 2 versions" ] and check.
Sep 17, 2022
2
Level 1
How to automatically prefix scss with autoprefix in vite
I have installed postcss and autoprefix in in npm with
npm i autoprefixer && npm i postcss
and my vite.config.js file looks like this:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react'
import autoprefixer from 'autoprefixer';
export default defineConfig({
plugins: [
react(),
laravel({
input: [
'resources/sass/app.scss',
'resources/js/index.tsx',
],
refresh: true,
postcss: {
plugins: [
autoprefixer(),
]
},
}),
],
});
But when I run npm run dev or npm run build the css doesn`t seem to be prefixed. How can I fix this? I have also tried to create a postcss.config.js file like this:
module.exports = {
plugins: {
autoprefixer: {}
}
}
But this also doesn`t work.
I have "browserlists": [ "defaults" ] in my package.json
Please or to participate in this conversation.