Skip to content

Instantly share code, notes, and snippets.

@javan
Created April 30, 2019 18:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save javan/b05031b4f77851dd80a6e69495f5888a to your computer and use it in GitHub Desktop.
Save javan/b05031b4f77851dd80a6e69495f5888a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
TMP_DIR="/tmp/stimulus-polyfills"
OUT_FILE="$(pwd)/stimulus-polyfills.js"
mkdir -p "$TMP_DIR"
cd "$TMP_DIR"
echo "--- Installing dependencies"
npm install --save-dev rollup rollup-plugin-node-resolve rollup-plugin-commonjs @stimulus/polyfills 2>/dev/null
echo "--- Building"
cat << EOF > ./rollup.config.js
import resolve from "rollup-plugin-node-resolve"
import commonjs from "rollup-plugin-commonjs"
export default {
input: "node_modules/@stimulus/polyfills/index.js",
output: {
file: "$OUT_FILE",
format: "iife"
},
plugins: [
resolve(),
commonjs()
]
}
EOF
./node_modules/.bin/rollup -c rollup.config.js
rm -rf "$TMP_DIR"
echo
echo "Done!"
@javan
Copy link
Author

javan commented Apr 30, 2019

$ curl -Ls https://git.io/fjZI5 | sh
--- Installing dependencies
+ rollup-plugin-commonjs@9.3.4
+ rollup-plugin-node-resolve@4.2.3
+ rollup@1.10.1
+ @stimulus/polyfills@1.1.1
added 129 packages from 145 contributors and audited 923 packages in 4.156s
found 0 vulnerabilities

--- Building

node_modules/@stimulus/polyfills/index.js → ../../../Users/javan/Desktop/stimulus-polyfills.js...
created ../../../Users/javan/Desktop/stimulus-polyfills.js in 580ms

Done!
$ ls -lh stimulus-polyfills.js 
-rw-r--r--  1 javan  staff    62K Apr 30 14:53 stimulus-polyfills.js

@zaher-elrody
Copy link

Hi, I have this issue with internet Explorer 11 and i have a gulpfile that manages my client side data bundle. But I am unable to integrate the polyfills in it. Can you help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment