Socket
Socket
Sign inDemoInstall

babel-plugin-inline-json

Package Overview
Dependencies
14
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-inline-json

[![Build Status](https://travis-ci.org/gkatsev/babel-plugin-inline-json.svg?branch=master)](https://travis-ci.org/gkatsev/babel-plugin-inline-json)


Version published
Maintainers
1
Install size
1.16 MB
Created

Readme

Source

babel-plugin-inline-json

Build Status

Inline values from a JSON file eg. a config file

Does not work if the argument to require() is an identifier or a template literal

Example

config.json:

{
  "foo": "bar"
}

In

var foo = require('config').foo;

Out

var foo = "bar";

Installation

$ npm install babel-plugin-inline-json --save-dev

Usage

.babelrc

{
  "plugins": [["inline-json", {"matchPattern": "config"}]]
}

Via CLI

$ babel --plugins inline-json script.js

Via Node API

require("babel-core").transform("code", {
  "plugins": [["inline-json", {"matchPattern": "config"}]]
});

Origin

this is based on @mwilliams-change's babel-plugin-inline-json-config-values.

Keywords

FAQs

Last updated on 10 Jun 2021

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