Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitshiftza/rollup-plugin-ts-paths
Resolve modules from tsconfig paths in Rollup
https://github.com/bitshiftza/rollup-plugin-ts-paths
plugin rollup typescript
Last synced: 25 days ago
JSON representation
Resolve modules from tsconfig paths in Rollup
- Host: GitHub
- URL: https://github.com/bitshiftza/rollup-plugin-ts-paths
- Owner: bitshiftza
- License: mit
- Created: 2018-06-18T20:05:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T18:29:30.000Z (over 3 years ago)
- Last Synced: 2024-04-29T17:07:07.788Z (8 months ago)
- Topics: plugin, rollup, typescript
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 22
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - ts-paths
README
# rollup-plugin-ts-paths
Replace alias with resolved import from paths in tsconfig.json. Let's you use rollup to bundle/transpile code generated by `tsc` like this
```js
// src/path/to/foo/foot.ts
import { Foo } from 'foo';
```
where foo is defined in `tsconfig.json````json
{
"compilerOptions": {
"paths": {
"foo": [
"src/path/to/foo/foo.ts"
]
}
}
}```
## Installation
```bash
npm install --save-dev rollup-plugin-ts-paths
```## Usage
Generally, you need to ensure that rollup-plugin-ts-paths goes *before* other things (like rollup-plugin-commonjs) in your `plugins` array, so that the correc file can be resolved from an import.
```js
// rollup.config.js
import tsConfigPaths from 'rollup-plugin-ts-paths';export default {
// ...
plugins: [
tsConfigPaths()
]
};
```## Options
```js
{
// The directory the TS config file can be found in (optional)
tsConfigDirectory: processs.cwd()
}
```## Limitations
Currently on the first entry of a path specified in a `tsconfig.json` is supported.
## License
MIT