# single-spa-generate-imports-webpack

> A webpack plugin which allow to generate importmap.json with output filename for single-spa application on compile

Latest version **0.1.4** (published 2021-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install single-spa-generate-imports-webpack
pnpm add single-spa-generate-imports-webpack
yarn add single-spa-generate-imports-webpack
bun add single-spa-generate-imports-webpack
```

## 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.4 |
| Published | 2021-06-18 |
| First published | 2021-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Luan Nguyen |
| Maintainers | vluanna |
| Keywords | webpack, single-spa, generate imports |

## Links

- npm: https://www.npmjs.com/package/single-spa-generate-imports-webpack
- Repository: https://github.com/vluanna/single-spa-generate-imports-webpack
- Homepage: https://github.com/vluanna/single-spa-generate-imports-webpack#readme
- Issues: https://github.com/vluanna/single-spa-generate-imports-webpack/issues
- npm.io page: https://npm.io/package/single-spa-generate-imports-webpack

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2021-06-18
- 0.1.3 — 2021-05-31
- 0.1.2 — 2021-05-31
- 0.1.1 — 2021-05-28
- 0.1.0 — 2021-05-26

## README

# single-spa-generate-imports-webpack
A webpack plugin which allow to generate importmap.json with output filename for single-spa application on compile.

## Installation

```
npm install --save-dev single-spa-generate-imports-webpack
```

## Usage

In config file:

``` javascript
const SingleSpaGenerateImports = require('single-spa-generate-imports-webpack');
// ...
  module: {
    plugins: [
      new SingleSpaGenerateImports({
        packageName: '@hulk/core', // required
        staticPath: 'http://some.url/point/to/your/import/path', // default from env process.env.STATIC_PATH
        filename: 'importmap.json'
      }),
    ]
  },
// ...
```

Generate file:

``` javascript
// dist/importmap.json
{
  imports: {
    "@hulk/core": "http://some.url/point/to/your/import/path/hulk-core.<hash>.js"
  }
}
```

Multi Entry points:

``` javascript
const SingleSpaGenerateImports = require('single-spa-generate-imports-webpack');
// ...
  module: {
    entry: {
      'hulk-styleguide': `./src/main.ts`,
      'styles': `./src/styles.ts`,
    }
    ...
    plugins: [
      new SingleSpaGenerateImports({
        packageName: {
          'hulk-styleguide': '@hulk/styleguide',
          'styles': '@hulk/styleguide/styles',
          ...
        }
        ...
      }),
    ]
  },
// ...
```
Generate file multi imports:

``` javascript
// dist/importmap.json
{
  imports: {
    "@hulk/styleguide": "http://some.url/point/to/your/import/path/hulk-styleguide.<hash>.js"
    "@hulk/styleguide/styles": "http://some.url/point/to/your/import/path/styles.<hash>.js"
    ...
  }
}
```

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