# rollup-plugin-includepaths

> Rollup plugin to use relative paths in your project files

Latest version **0.2.4** (published 2020-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-includepaths
pnpm add rollup-plugin-includepaths
yarn add rollup-plugin-includepaths
bun add rollup-plugin-includepaths
```

## 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.2.4 |
| Published | 2020-08-18 |
| First published | 2016-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 96 |
| Author | Darlan Alves |
| Maintainers | darlanalves |
| Keywords | rollup-plugin, rollup, es6 |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-includepaths
- Repository: https://github.com/dot-build/rollup-plugin-includepaths
- Homepage: https://github.com/dot-build/rollup-plugin-includepaths#readme
- Issues: https://github.com/dot-build/rollup-plugin-includepaths/issues
- npm.io page: https://npm.io/package/rollup-plugin-includepaths

## 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.2.4 (latest) — 2020-08-18
- 0.2.3 — 2018-06-21
- 0.2.2 — 2017-03-17
- 0.1.8 — 2017-01-02
- 0.2.1 — 2016-11-29
- 0.2.0 — 2016-11-27
- 0.1.7 — 2016-11-27
- 0.1.6 — 2016-09-15
- 0.1.5 — 2016-05-10
- 0.1.4 — 2016-05-09
- 0.1.3 — 2016-05-09
- 0.1.2 — 2016-03-21
- 0.1.1 — 2016-02-22
- 0.1.0 — 2016-02-06

## README

# rollup-plugin-includepaths

Let you use relative paths in your import directives, like this:

```js
// from src/lib/one/foo.js
import { Foo } from 'one/foo';

// from src/other/two/bar.js
import { Bar } from 'two/bar';

```

## Setup

In your rollup configuration file:

```js

import includePaths from 'rollup-plugin-includepaths';

let includePathOptions = {
    include: {},
    paths: ['src/lib', 'src/other'],
    external: [],
    extensions: ['.js', '.json', '.html']
};

export default {
    entry: './app.js',
    format: 'cjs',
    dest: 'public/app.min.js',
    plugins: [ includePaths(includePathOptions) ],
};

```

## Options:

### paths = `['']`

An array of source paths in your project where the plugin should look for files

Example: `['src/lib', 'src/foo']`

By default, resolve files from working dir

### include

A map of module=>path/to/file.js with custom module paths. Used to override the search with a static path (like Browserify does with the "browser" config).

Use this option if you want to skip the file resolution and directly resolve a module name to a given path.

Example:

```js
include: {
    // Import example: import angular from 'angular';
    'angular': 'bower_components/angular/angular.js'
}
```

### external

An array of module names that should be excluded from the bundle (external modules).

By default, all the node built-in modules will be marked as external.

To include the built-ins, you can use the [builtins](https://github.com/calvinmetcalf/rollup-plugin-node-builtins) plugin and set this config to an empty array.

Example:

```js
// will not include the module 'angular' in the final bundle
external: ['angular']
```


### extensions

An array of file extensions to look for in the project.

Default: `['.js', '.json']`

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