Skip to content

Commit

Permalink
chore(es/minifier): Make minify-all example ignore parsing errors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Feb 18, 2025
1 parent 13105b5 commit 6c7ec46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions crates/swc_ecma_minifier/examples/minify-all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn minify_all(files: &[PathBuf]) {
let unresolved_mark = Mark::new();
let top_level_mark = Mark::new();

let program = parse_file_as_module(
let Ok(program) = parse_file_as_module(
&fm,
Default::default(),
Default::default(),
Expand All @@ -104,8 +104,9 @@ fn minify_all(files: &[PathBuf]) {
})
.map(Program::Module)
.map(|module| module.apply(&mut resolver(unresolved_mark, top_level_mark, false)))
.map(|module| module.apply(&mut paren_remover(None)))
.unwrap();
.map(|module| module.apply(&mut paren_remover(None))) else {
return Ok(());
};

let output = optimize(
program,
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_ecma_minifier/scripts/next/add-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ rm -rf .next
# This is not useful data, as this is a script used only by me (@kdy1)
npx next telemetry disable

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

0 comments on commit 6c7ec46

Please sign in to comment.