# namespace-imports-loader

> namespace imports loader module for webpack

Latest version **0.1.0** (published 2016-08-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install namespace-imports-loader
pnpm add namespace-imports-loader
yarn add namespace-imports-loader
bun add namespace-imports-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.1.0 |
| Published | 2016-08-04 |
| First published | 2016-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kayne Barclay @kayneb |
| Maintainers | kayneb |

## Links

- npm: https://www.npmjs.com/package/namespace-imports-loader
- Repository: https://github.com/kayneb/namespace-imports-loader
- Issues: https://github.com/kayneb/namespace-imports-loader/issues
- npm.io page: https://npm.io/package/namespace-imports-loader

## Dependencies (2)

- [source-map](https://npm.io/package/source-map.md) 0.1.x
- [loader-utils](https://npm.io/package/loader-utils.md) 0.2.x

## Recent versions

- 0.1.0 (latest) — 2016-08-04

## README

# namespace imports loader for webpack

Can be used to inject variables into the scope of a module under some namespace. This is especially useful if third-party modules are relying on some namespace being initialized with some value like `com.foo.bar`.

Heavily inspired by [imports-loader](https://github.com/webpack/imports-loader)

## Installation

```
npm install namespace-imports-loader
```

## Usage

Given you have this file `example.js`

```javascript

var value = com.foo.bar.getValue()
```

then you can inject the `com.foo.bar` namespace into the module by configuring the namespace-imports-loader like this:

``` javascript
require("namespace-imports?com.foo.bar=someFile!./example.js");
```

It is possible to put multiple values on the same namespace. It will merge the values into one object.

### webpack.config.js

As always, you should rather configure this in your `webpack.config.js`:

```javascript
// ./webpack.config.js

module.exports = {
    ...
    module: {
        loaders: [
            {
                test: require.resolve("some-module"),
                loader: "namespace-imports?com.foo.bar=someFile"
            }
        ]
};
```

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

## License

MIT (http://www.opensource.org/licenses/mit-license.php)

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