diff --git a/package.json b/package.json index cf3dacbc..1731574d 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,7 @@ "testui": "grunt testui", "testuidev": "npx nightwatch --env=dev", "lint": "grunt lint", - "postinstall": "find ./node_modules/crypto-api/src/ \\( -type d -name .git -prune \\) -o -type f -print0 | xargs -0 sed -i '' -e '/\\.mjs/!s/\\(from \"\\.[^\"]*\\)\";/\\1.mjs\";/g'", + "postinstall": "sh postinstall.sh", "newop": "node --experimental-modules src/core/config/scripts/newOperation.mjs" } } diff --git a/postinstall.sh b/postinstall.sh new file mode 100755 index 00000000..dc685308 --- /dev/null +++ b/postinstall.sh @@ -0,0 +1,6 @@ +# Add file extensions to Crypto-Api imports +if [[ "$OSTYPE" == "darwin"* ]]; then + find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i '' -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g' +else + find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g' +fi \ No newline at end of file