glebmachine/postcss-cachebuster

Paths in opts are broken if cachebuster called multiple times

Opened this issue · 0 comments

When using postcss in Vite with Vue components, processors gets run multiple times on different files, and imported from the same ES6 scope.

The opts list at the start of postcss-cachebuster prepends process.cwd() to both path options on each run, so only the first run will have correct paths - everything afterwards will have cwd() added to it multiple times.

There's an easy fix - put the results of those prepends in opts.imagesPathResolved and opts.cssPathResolved and reference those in the code instead.