You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@babel/helper-define-polyfill-provider

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-define-polyfill-provider

Babel helper to create your own polyfill provider

0.5.0
Source
npmnpm
Version published
Weekly downloads
25M
-18.51%
Maintainers
4
Weekly downloads
 
Created

What is @babel/helper-define-polyfill-provider?

The @babel/helper-define-polyfill-provider package is part of the Babel ecosystem and is used to define a way to provide polyfills in your Babel configuration. It helps in specifying which polyfills to include based on the target environment and the features used in your code, ensuring that only necessary polyfills are added, thus optimizing the bundle size.

What are @babel/helper-define-polyfill-provider's main functionalities?

Define polyfill provider

This code sample demonstrates how to define a custom polyfill provider using the @babel/helper-define-polyfill-provider package. It specifies polyfills for 'Promise' and 'fetch' with their respective detection logic and paths to their polyfill modules.

import { createPolyfillProvider } from '@babel/helper-define-polyfill-provider';

const myPolyfillProvider = createPolyfillProvider({
  name: 'myPolyfillProvider',
  polyfills: {
    'Promise': {
      global: 'Promise',
      detection: 'Promise in global',
      path: 'core-js/modules/es.promise'
    },
    'fetch': {
      global: 'fetch',
      detection: 'fetch in global',
      path: 'whatwg-fetch'
    }
  }
});

Other packages similar to @babel/helper-define-polyfill-provider

Keywords

babel-plugin

FAQs

Package last updated on 18 Jan 2024

Did you know?

Socket

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