New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-inline-json-import

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-inline-json-import

Inlines JSON file imports straight into JS code

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by1.24%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-inline-json-import

NPM

Build Status

A babel pre-processor that inlines all imports of JSON files straight into your JavaScript files.

Example

Given the following JSON file:

{
  "foo": "bar"
}

The plugin will transform the following statement:

import json from './path/to/file.json';

or

to:

const json = { foo: "bar" };

Simple as that! Both require and import are supported.

Installation

Install the plugin through npm, you will also need babel installed for obvious reasons:

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

Add babel-plugin-inline-json-import to the list of plugins. If you are using a .babelrc file, the file should have an entry that looks like this:

{
  "plugins": [
    ["inline-json-import", {}]
  ]
}

Usage

This should work straight out of the box without any configuration.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request =)

License

This project is licensed under the MIT License - see the LICENSE file for details

FAQs

Package last updated on 07 Mar 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc