Socket
Socket
Sign inDemoInstall

@lite-v3/polyfills

Package Overview
Dependencies
84
Maintainers
7
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lite-v3/polyfills

A standard polyfill library for tokopedia web services


Version published
Weekly downloads
708
increased by217.49%
Maintainers
7
Install size
1.48 MB
Created
Weekly downloads
 

Readme

Source

@lite-v3/polyfills

A standard polyfill library for tokopedia web services

By Tokopedia Version

This module is only needed for webpack 4+.

Prerequisites

Webpack 4+

Install

# Using npm
npm install @lite-v3/polyfills

# Using yarn
yarn add @lite-v3/polyfills

# Using pnpm
pnpm install @lite-v3/polyfills

Usage

Add the following to your entry client file:

import requirePolyfills, { definePolyfills } from '@lite-v3/polyfills';

requirePolyfills(condition, function () {
  runYourService();
});

or if you have additional polyfills

import requirePolyfills from '@lite-v3/polyfills';

const customPolyfills = [
  {
    test: !(window.fetch || window.self.fetch),
    load: () => {
      return new Promise(resolve => {
        resolve(import(/* webpackChunkName: "unfetch-polyfill" */ 'unfetch/polyfill/index'));
      });
    },
  },
];

requirePolyfills(condition, definePolyfills(customPolyfills), function () {
  runYourService();
});

API

requirePolyfills(condition, callback)

parameter

condition: Boolean callback: () => void

definePolyfills(polyfills)

parameter

polyfills: { test: boolean, load: () => Promise<unknown> }[]}


Code By WPE Team @Tokopedia

FAQs

Last updated on 14 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc