FullHuman / purgecss

Remove unused CSS
https://purgecss.com
MIT License
7.8k stars 248 forks source link

Sourcemap are "empty" when using Webpack plugin #409

Closed jimblue closed 2 years ago

jimblue commented 4 years ago

Hello,

I have the following Purge CSS Plugin configuration in Webpack 4 :

new PurgeCssPlugin({ paths: glob.sync(Settings.filesToPurge, { nodir: true }) })

And my source map look like this :

{"version":3,"sources":[],"names":[],"mappings":"","file":"css/main.d010269e7b0748fe040a.css","sourceRoot":""}

When I replace Purge CSS Plugin by the same configuration but inside Post CSS Loader my source map seems ok and look like this :

{"version":3,"sources":["webpack:///main.scss","webpack:///utilities/_variables.scss","webpack:///../../node_modules/bulma/sass/utilities/mixins.sass","webpack:///../../node_modules/bulma/sass/utilities/animations.sass","webpack:///../../node_modules/bulma/sass/utilities/controls.sass","webpack:///base/_animations.scss","webpack:///../fonts/librebaskerville/_stylesheet.scss","webpack:///../fonts/metropolis/_stylesheet.scss","webpack:///../../node_modules/bulma/sass/elements/button.sass","webpack:///../../node_modules/bulma/sass/elements/container.sass",],"names":[],"mappings":"AAAA,gBAAgB,s95ECAhB,SC2IA,SFnIA,S,SE0JE,S,SFrJF,S,SE4OA,SFxJA,S,SEkKA,SF1IA,S,SGzHA,SHkIA,S,SGlIA,SHkIA,SI3FA,SJ8GA,SIvHE,SJ0HF,SIrHE,SJwHF,S,SKvJA,SL+KA,SKlJA,SLwJA,S,SMtLA,SN8LA,SMtLA,SN6LA,SMrLA,SN4LA,SO5MA,SPmNA,SO3MA,SPkNA,SO1MA,SPiNA,SOzMA,SPgNA,SOxMA,SP+MA,SQpMA,SRmNA,SQ/LI,SRsMJ,SQhMI,SRoMJ,SQjMI,SRqMJ,SQlMI,SRsMJ,SQlME,SRsMF,SQlME,SRsMF,SQlMI,SRqMJ,SQnME,SRuMF,SQlME,SRwMF,SQnMI,SRuMJ,SQjMI,SRqMJ,SQjMI,SRsMJ,SQ9LI,SRmMJ,SQ/LM,SRoMN,SQ/LM,SRmMN,SQ/LQ,SRkMR,SQhMM,SRqMN,SQhMM,SRqMN,SQnLQ,SRmMR,SQjMM,SRsMN,SQlMQ,SRuMR,SQ/LU,SRkMV,SQ5LY,SR+LZ,SQ7LQ,SRmMR,SQ/PI,SRsRJ,SQlRM,SRuRN,SQlRM,SRsRN,SQlRQ,SRqRR,SQnRM,SRwRN,SQnRM,SRwRN,SQtQQ,SRsRR,SQpRM,SRyRN,SQrRQ,SR0RR,SQlRU,SRqRV,SQ/QY,SRkRZ,SQhRQ,SRsRR,SQlVI,SRyWJ,SQrWM,SR0WN,SQrWM,SRyWN,SQrWQ,SRwWR,SQtWM,SR2WN,SQtWM,SR2WN,SQzVQ,SRyWR,SQvWM,SR4WN,SQxWQ,SR6WR,SQrWU,SRwWV,SQlWY,SRqWZ,SQnWQ,SRyWR,SQraI,SR4bJ,SQxbM,SR6bN,SQxbM,SR4bN,SQxbQ,SR2bR,SQzbM,SR8bN,SQzbM,SR8bN,SQ5aQ,SR4bR,SQ1bM,SR+bN,SQ3bQ,SRgcR,SQxbU,SR2bV,SQrbY,SRwbZ,SQtbQ,SR4bR,SQxfI,SRkmBJ,SQ9lBM,SRmmBN,SQ9lBM,SRkmBN,SQ9lBQ,SRimBR,SQ/lBM,SRomBN

Seems something is broken with the plugin

wilbertcaba commented 4 years ago

I'm running through the exact same issue @jsnanigans @Ffloriel

wscfe commented 3 years ago

how to solve this

chaoticvibe commented 3 years ago

I'm running through the exact same issue. Withou purgecss my webpack settings emit well css source-map.

rob-c-baker commented 3 years ago

I managed to work around this by removing the webpack plugin and using PurgeCSS via a PostCSS plugin instead. This means PostCSS is handling the source-map.

jimblue commented 3 years ago

Hi there, Just a friendly ping to know if a fix for this issue is planned in the roadmap ? Cheers

jimblue commented 2 years ago

🙏🏼 thank you 🙏🏼