# rollup-plugin-self-resolve

> ## Usage

Latest version **0.1.0** (published 2020-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-self-resolve
pnpm add rollup-plugin-self-resolve
yarn add rollup-plugin-self-resolve
bun add rollup-plugin-self-resolve
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-04-28 |
| First published | 2020-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=13.0.0 |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | fusionstrings |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-self-resolve
- Repository: https://github.com/fusionstrings/rollup-plugin-self-resolve
- Homepage: https://github.com/fusionstrings/rollup-plugin-self-resolve#readme
- Issues: https://github.com/fusionstrings/rollup-plugin-self-resolve/issues
- npm.io page: https://npm.io/package/rollup-plugin-self-resolve

## Recent versions

- 0.1.0 (latest) — 2020-04-28

## README

# rollup-plugin-self-resolve

## Usage

Should be used from Rollup Javascript API because passing Node JS flag --experimental-import-meta-resolve is required
https://rollupjs.org/guide/en/#differences-to-the-javascript-api

```js
// build.js

import { rollup } from 'rollup';
import plugin from 'rollup-plugin-self-resolve';

// same as rollup.config.js
const options = {
    input: './fixture.js',
    output: {
        dir: 'dist',
        format: 'esm',
        sourcemap: true
    },
    plugins: [
        plugin()
    ]
};

async function builder() {
    const { input, output, plugins } = options;
    
	const bundle = await rollup({ input, plugins });

	await bundle.write(output);
}

builder();

```

```sh
node --experimental-import-meta-resolve --trace-warnings ./build.js
```

## Motivation
Support https://nodejs.org/api/esm.html#esm_self_referencing_a_package_using_its_name until [rollup Resolver](https://rollupjs.org/guide/en/#configuration-files) supports it natively.

## Status
Serves my needs. Please feel free to contribute or create your own if this is insufficient.
If it's bellow your standards, please lower yours.

## Future
[] Obsolete once Rollup natively supports it
[] Improve quality

---
_Source: https://npm.io/package/rollup-plugin-self-resolve · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
