Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return callback(err)
}
const postcssLoader = this.loaders[postcssLoaderIndex]
let postcssPlugins
let postcssOptions
// imitating postcss-loader behavior
// https://github.com/postcss/postcss-loader/blob/master/src/index.js
if (
Object.keys(postcssLoader.options || {}).filter(
option => !['ident', 'config', 'sourceMap'].includes(option)
).length > 0
) {
const { options, plugins } = await parsePostcssLoaderOptions.call(
this,
postcssLoader.options
)
postcssOptions = options
postcssPlugins = plugins
} else {
const file = this.resourcePath
const rc = {
path: path.dirname(file),
ctx: {
cwd: this.context,
file: {
extname: path.extname(file),
dirname: path.dirname(file),
basename: path.basename(file),
},
function postcss(loader, css, map, meta, cb) {
const ctx = { ...loader };
ctx.async = () => cb;
ctx.loaderIndex++;
ctx.query = {
plugins: [postcssNested(), postcssAtroot()],
};
postcssLoader.call(ctx, css, map, meta);
}