Skip to content

Commit 6c7ec46

Browse files
authoredFeb 18, 2025··
chore(es/minifier): Make minify-all example ignore parsing errors (#10045)
1 parent 13105b5 commit 6c7ec46

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎crates/swc_ecma_minifier/examples/minify-all.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn minify_all(files: &[PathBuf]) {
9292
let unresolved_mark = Mark::new();
9393
let top_level_mark = Mark::new();
9494

95-
let program = parse_file_as_module(
95+
let Ok(program) = parse_file_as_module(
9696
&fm,
9797
Default::default(),
9898
Default::default(),
@@ -104,8 +104,9 @@ fn minify_all(files: &[PathBuf]) {
104104
})
105105
.map(Program::Module)
106106
.map(|module| module.apply(&mut resolver(unresolved_mark, top_level_mark, false)))
107-
.map(|module| module.apply(&mut paren_remover(None)))
108-
.unwrap();
107+
.map(|module| module.apply(&mut paren_remover(None))) else {
108+
return Ok(());
109+
};
109110

110111
let output = optimize(
111112
program,

‎crates/swc_ecma_minifier/scripts/next/add-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ rm -rf .next
1616
# This is not useful data, as this is a script used only by me (@kdy1)
1717
npx next telemetry disable
1818

19-
npm run build | node "$SCRIPT_DIR/evaluate.js"
19+
npx next build | node "$SCRIPT_DIR/evaluate.js"
2020
touch "$SCRIPT_DIR/../../tests/compress.rs"

0 commit comments

Comments
 (0)
Please sign in to comment.