Skip to content

Commit

Permalink
build(convert_to_cjs.sh): handle await import
Browse files Browse the repository at this point in the history
  • Loading branch information
blephy committed Sep 20, 2022
1 parent d6d7c22 commit 1d5c4a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/convert_to_cjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ for path in $files; do
echo "Converting $path"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sed -r -i'' "s/(require ?[^\"]+\"([^\"]+))\.js/\1.cjs/" "$path"
sed -r -i'' "s/(require ?[^\"\']+[\"\']([^\"\']+))\.js(\'|\")/\1.cjs\3/" "$path"
elif [[ "$OSTYPE" == "darwin"* ]]; then
sed -r -i '' "s/(require ?[^\"]+\"([^\"]+))\.js/\1.cjs/" "$path"
sed -r -i '' "s/(require ?[^\"\']+[\"\']([^\"\']+))\.js(\'|\")/\1.cjs\3/" "$path"
fi

mv "$path" "${path/%.js/.cjs}"
Expand Down

0 comments on commit 1d5c4a2

Please sign in to comment.