Skip to content

Commit

Permalink
build: fix esm build import with line break [#242]
Browse files Browse the repository at this point in the history
fixes "Cannot find module **/constants from **/config.mjs"
  • Loading branch information
leomp12 committed Nov 10, 2022
1 parent 00f9b6d commit e23e09e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions build/esm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

cp -r ./src ./dist/esm
find dist/esm -type f -name "*.js" -print0 | xargs -0 sed -i -r "s/([ie][mx]port [^']+?)'(\\.[^']+)'/\\1'\\2.mjs'/g"
find dist/esm -type f -name "*.js" -print0 | xargs -0 sed -i -r "s/(} from )'(\\.[^']+)'/\\1'\\2.mjs'/g"
find dist/esm -type f -name "*.js" -print0 | xargs -0 sed -i -r "s/.([cm])js.mjs/.\\1js/g"
for file in ./dist/esm/*.js; do
mv -- "$file" "${file%.js}.mjs"
Expand Down

0 comments on commit e23e09e

Please sign in to comment.