# babel-plugin-import-json-value

> A babel plugin to inlines json value into your js files!

Latest version **0.1.2** (published 2020-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-import-json-value
pnpm add babel-plugin-import-json-value
yarn add babel-plugin-import-json-value
bun add babel-plugin-import-json-value
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-11-30 |
| First published | 2020-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | changqing |
| Maintainers | changqingnpm |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-import-json-value
- Repository: https://github.com/changqingom/babel-plugin-import-json-value
- Homepage: https://github.com/changqingom/babel-plugin-import-json-value#readme
- Issues: https://github.com/changqingom/babel-plugin-import-json-value/issues
- npm.io page: https://npm.io/package/babel-plugin-import-json-value

## Recent versions

- 0.1.2 (latest) — 2020-11-30
- 0.1.1 — 2020-11-30
- 0.1.0 — 2020-11-30
- 0.0.4 — 2020-11-30
- 0.0.3 — 2020-11-27
- 0.0.2 — 2020-11-27
- 0.0.1 — 2020-11-27

## README

# babel-plugin-import-json-value
[![NPM](https://nodei.co/npm/babel-plugin-import-json-value.png?downloads=true&stars=true)](https://npmjs.org/package/babel-plugin-inline-json-import)

[中文文档](./README_CN.md)

A babel pre-processor that inlines all imports of JSON files straight into your
JavaScript files.

## Example

My package.json file:

```json
{
  "name": "babel-plugin-import-json-value",
  "version": "0.0.3",
  "devDependencies": {
    "@babel/cli": "^7.12.8"
  }
}
```

input:

```js
import { version, name as name1, default as pkg } from "./data.json";
import pkg1 from "./data.json";
import * as pkg2 from "./data.json";
const pkg3 = require("./data.json");
const { version1, name: name2 } = require("./data.json");
const name3 = require("./data.json").name;
const text1 = require("./data.json").devDependencies["@babel/cli"];
```

output:

```js
const version = "0.0.3",
      name1 = "babel-plugin-import-json-value",
      pkg = "{\"name\":\"babel-plugin-import-json-value\",\"version\":\"0.0.3\",\"devDependencies\":{\"@babel/cli\":\"^7.12.8\"}}";
const pkg1 = "{\"name\":\"babel-plugin-import-json-value\",\"version\":\"0.0.3\",\"devDependencies\":{\"@babel/cli\":\"^7.12.8\"}}";
const pkg2 = "{\"name\":\"babel-plugin-import-json-value\",\"version\":\"0.0.3\",\"devDependencies\":{\"@babel/cli\":\"^7.12.8\"}}";
const pkg3 = "{\"name\":\"babel-plugin-import-json-value\",\"version\":\"0.0.3\",\"devDependencies\":{\"@babel/cli\":\"^7.12.8\"}}";
const version1 = undefined,
      name2 = "babel-plugin-import-json-value";
const name3 = "babel-plugin-import-json-value";
const text1 = "^7.12.8";

```


## Installation

```sh
$ yarn add -D babel-plugin-import-json-value
```

Add `babel-plugin-import-json-value` to your babel config . 
```json
{
  "plugins": [
    "babel-plugin-import-json-value"
  ]
}
```

## Tips

**Value types other than strings are not currently supported, and the rest will be implemented later**

- TODO:

- [ ] Support other value types.
- [x] Support import and require default export.
- [ ] Support esModule export.


## License
This project is licensed under the MIT License - see the [LICENSE](/LICENSE)
file for details

---
_Source: https://npm.io/package/babel-plugin-import-json-value · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
