I came across this strange error in Svelte; every time I ran npm run dev
, this vite error would appear:
[vite] Internal server error: Failed to load PostCSS config (searchPath: /Users/Documents/Personal projects): [Failed to load PostCSS config] Failed to load PostCSS config (searchPath: /Users/Documents/Personal projects): [Failed to load PostCSS config] Failed to load PostCSS config (searchPath: /Users/Documents/Personal projects): [Error] Cannot find module 'autoprefixer'
I'm new to vite so it took me an hour of research, to figure out how to export the module, I was able to fix it by creating a postcss.config.cjs
file and inside the file add:
module.exports = {
autoprefixer: {}
}
I hope this helps anyone that comes across the same/similar error.
.cjs
. See issue on GitHub – Amoritta