# @csgis/json-modules-loader

> A Webpack loader that loads a JSON object and resolves paths to actual modules.

Latest version **0.0.1** (published 2017-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @csgis/json-modules-loader
pnpm add @csgis/json-modules-loader
yarn add @csgis/json-modules-loader
bun add @csgis/json-modules-loader
```

## 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.0.1 |
| Published | 2017-11-23 |
| First published | 2017-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Author | Víctor González |
| Maintainers | vicgonco |

## Links

- npm: https://www.npmjs.com/package/@csgis/json-modules-loader
- Repository: git@github.com:csgis/json-modules-loader
- npm.io page: https://npm.io/package/@csgis/json-modules-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ^1.1.0

## Recent versions

- 0.0.1 (latest) — 2017-11-23

## README

[![Build Status](https://travis-ci.org/csgis/json-modules-loader.svg?branch=master)](https://travis-ci.org/csgis/json-modules-loader) [![codecov](https://codecov.io/gh/csgis/json-modules-loader/branch/master/graph/badge.svg)](https://codecov.io/gh/csgis/json-modules-loader) [![npm](https://img.shields.io/npm/v/@csgis/json-modules-loader.svg)](https://www.npmjs.com/package/@csgis/json-modules-loader) [![downloads](https://img.shields.io/npm/dt/@csgis/json-modules-loader.svg)](https://www.npmjs.com/package/@csgis/json-modules-loader)

# JSON Modules loader

A Webpack loader that loads a JSON object and resolves paths to actual modules.

It is useful to decouple your dependencies from your code. Just replace the dependencies in you JSON file with others that behave the same.

## Install

With npm:

```
npm install --save-dev @csgis/json-modules-loader
```

With yarn:

```
yarn add -D @csgis/json-modules-loader
```

## Usage

**webpack.config.js**

```js
{
   test: /app\.json$/,
   use: [ '@csgis/json-modules-loader' ]
}
```

**app.json**
```json
{
  "modules": {
    "x": "react",
    "y": "react-dom"
  }
}
```

**file.js**
```js
import app from './app.json';

app.modules.y.render(
  app.modules.x.createElement(Hello, {toWhat: 'World'}, null),
  document.getElementById('root')
);
```

## Options

| Name        | Type          | Default   | Description |
|-------------|---------------|-----------|-------------|
| key         | `{ String } ` | `modules` | Name of the property JSON property with paths to be resolved. |
| importName  | `{ String } ` | `default` | Name of the export to use as module value. |

---
_Source: https://npm.io/package/@csgis/json-modules-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
