1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-07-05 12:28:51 +00:00

Simplified ESM import.

The issue #303 was opened because twemoji library cannot be
imported through modern browsers as ECMAScript module.

This commit adds the simplest way to make any generic namespace
exported as default (esm.sh) and the raw copy of the minified library
exported as default `twemoji` module.
This commit is contained in:
Andrea Giammarchi 2018-07-17 11:37:08 +02:00
parent 5ce900d0fc
commit 1acf40da80
2 changed files with 26 additions and 0 deletions

4
2/esm.js Normal file

File diff suppressed because one or more lines are too long

22
esm.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
if [ ! -f "$1" ] || [ "$2" = "" ]; then
echo '
usage example:
./esm.sh ./path/module.js modname
will append:
export default modname;
at the end of:
./path/esm.js
'
else
cp "$1" "$(dirname "$1")/esm.js"
echo "
export default $2;
" >> "$(dirname "$1")/esm.js"
echo "
exported $2 as default
"
fi