Skip to content

Commit 360a967

Browse files
test: fix
1 parent 6b829c5 commit 360a967

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class CssMinimizerPlugin {
163163
minify = /** @type {MinimizerImplementation<InferDefaultType<T>>} */
164164
(cssnanoMinify),
165165
minimizerOptions = /** @type {MinimizerOptions<InferDefaultType<T>>} */
166-
({ preset: "default" }),
166+
({}),
167167
test = /\.css(\?.*)?$/i,
168168
warningsFilter = () => true,
169169
parallel = true,
@@ -499,14 +499,14 @@ class CssMinimizerPlugin {
499499
input = sourceFromInputSource;
500500

501501
if (map) {
502-
inputSourceMap = /** @type {RawSourceMap} */ (map);
503-
504502
if (!CssMinimizerPlugin.isSourceMap(map)) {
505503
compilation.warnings.push(
506504
/** @type {WebpackError} */ (
507505
new Error(`${name} contains invalid source map`)
508506
)
509507
);
508+
} else {
509+
inputSourceMap = /** @type {RawSourceMap} */ (map);
510510
}
511511
}
512512

src/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ function throttleAll(limit, tasks) {
7575
* @param {CustomOptions} minimizerOptions
7676
* @return {Promise<MinimizedResult>}
7777
*/
78-
async function cssnanoMinify(input, sourceMap, minimizerOptions) {
78+
async function cssnanoMinify(
79+
input,
80+
sourceMap,
81+
minimizerOptions = { preset: "default" }
82+
) {
7983
/**
8084
* @template T
8185
* @param {string} module

test/__snapshots__/minify-option.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" min
272272
exports[`"minify" option should work with "CssMinimizerPlugin.esbuildMinify" minifier and emit warnings: warning 1`] = `
273273
Array [
274274
"Warning: foo.css from Css Minimizer plugin
275-
Expected identifier but found whitespace",
275+
Expected identifier but found whitespace webpack://./wrong-calc.css:1:0",
276276
"Warning: foo.css from Css Minimizer plugin
277-
Unexpected \\"calc(\\"",
277+
Unexpected \\"calc(\\" webpack://./wrong-calc.css:1:0",
278278
]
279279
`;
280280

0 commit comments

Comments
 (0)