🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

babel-plugin-define-variables

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-define-variables

a babel define vars that like webpack.DefinePlugin

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
27
-48.08%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-define-variables

a babel plugin that like webpack.DefinePlugin

installtion

  npm install --save-dev babel-plugin-define-variables
  // or 
  yarn add -D babel-plugin-define-variables

config

// babel.config.js
module.exports = {
  presets: [
    ...
  ],
  plugins: [
    [
      'babel-plugin-define-variables',
      {
        defines: {
          a: 1,
          b: 'str',
          c: new Date(),
        }
      }
    ],
   ...
  ]
};

built-in define

  • __filename

  • __dirname

  • __now

  • __timestamp

  • __packagename

  • __packageversion

Keywords

babel

FAQs

Package last updated on 01 Dec 2020

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