postcss-cachebuster icon indicating copy to clipboard operation
postcss-cachebuster copied to clipboard

Paths in opts are broken if cachebuster called multiple times

Open betterthanclay opened this issue 2 years ago • 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.

betterthanclay avatar Jan 04 '23 18:01 betterthanclay