Skip to content

Commit

Permalink
fix: add package.json in CJS dist dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jul 21, 2024
1 parent 031b3d3 commit f91f275
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ for MODULE_TYPE in esm cjs; do
mv $FILE ${FILE/-browser/}
done

# If MODULE_TYPE is esm, copy bin files to dist
# esm/cjs-specific logic
if [ "$MODULE_TYPE" = "esm" ]; then
# ESM: copy bin files to dist
cp -pr "$DIR/../src/bin" "$DIST_DIR"
else
# CJS: Add package.json that specifies type: commonjs
echo "{\"type\":\"commonjs\"}" > "$DIST_DIR/package.json"
echo "{\"type\":\"commonjs\"}" > "$BROWSER_DIR/package.json"
fi
done

Expand Down

0 comments on commit f91f275

Please sign in to comment.