A polyfills package with the goal of standardizing polyfill implementations across Squarespace templates. core-js implementations of static and instance methods are preferred where available.
npm install --save @squarespace/polyfills;
import '@squarespace/polyfills/CustomEvent'; import '@squarespace/polyfills/Element/matches'; import '@squarespace/polyfills/Element/closest';
Usage Note: Bundlers
@squarespace/polyfills must be used with some kind of CommonJS-compatible script bundler (like Webpack, Browserify, Rollup, etc.)