Socket
Socket
Sign inDemoInstall

babel-plugin-define-patterns

Package Overview
Dependencies
4
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-define-patterns

Create constants that replace various expressions at build-time


Version published
Weekly downloads
1K
decreased by-41.35%
Maintainers
1
Install size
4.29 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-define-patterns

Create constants that replace various expressions at build-time

Install

npm install --save-dev babel-plugin-define-patterns

Usage

// babel.config.json
{
  "plugins": [
    ["define-patterns", {
      "replacements": {
        "process.env.NODE_ENV": "production",
        "typeof window": "object",
        "__DEV__": true,
        "require('currentBuildNumber')": 42
      }
    }]
  ]
}

Example

Input:

process.env.NODE_ENV

Options:

{
	"replacements": {
		"process.env.NODE_ENV": "development"
	}
}

Output:

"development"

For more examples see input.txt and output.txt.

Keywords

FAQs

Last updated on 16 Apr 2020

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