1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
# build cjs files
rm -rf cjs/*
BABEL_ENV=cjs babeljs lib -d cjs
echo '{\"type\":\"commonjs\"}' > cjs/package.json && cp lib/getFetch.cjs cjs/getFetch.js
node -e "fs.writeFileSync('cjs/request.js', fs.readFileSync('cjs/request.js').toString().replace('getFetch.cjs', 'getFetch.js'))"
# build esm files
rm -rf esm/*
BABEL_ENV=esm babeljs lib -d esm
cp lib/getFetch.cjs esm/getFetch.cjs
rm -f esm/getFetch.js
# build browser files
browserify-lite ./cjs/index.js --outfile i18nextHttpBackend.js --standalone i18nextHttpBackend
terser i18nextHttpBackend.js -o i18nextHttpBackend.min.js
|