In the webpack build process, seeing this warning
WARNING in ./node_modules/purgecss/lib/purgecss.es.js 397:18-28
Critical dependency: the request of a dependency is an expression
@ ./src/utils/renderPage.js
@ ./src/server.js
In the renderPage i'm using purgecss like this
import PurgeCSS from 'purgecss';
function purgeCSS(css, htmlBody, verticalName, isAmp) {
const { whitelist, whitelistPatternsChildren } = getWhitelists(test, testName, [], []);
const purgecss = new PurgeCSS({
});
const [] = purgecss.purge();
const {} = purgeCssResult;
return cleanCSS;
}
I tried below steps:
- adding
new webpack.ContextReplacementPlugin(/purgecss[\\/]lib/, false),
but this is causing errors and failing to load css - using alias -
alias: { purgecss: path.resolve(__dirname, 'node_modules/purgecss/purgecss'), },
- using
purgecss: path.resolve(__dirname, 'node_modules/purgecss/lib'),
"webpack": "^4.44.1", "webpack-cli": "^3.3.0", "webpack-dev-server": "^3.11.0", "purgecss": "^1.4.2",