rollup-preserve-directives
Version:
Rollup plugin to preserve directives
45 lines (33 loc) • 741 B
Markdown
A rollup plugin helps preserving shebang and string directives in your code.
```bash
npm install rollup-preserve-directives
```
```js
import preserveDirectives from 'rollup-preserve-directives'
export default {
input: './src/index.js',
output: {
file: './dist/index.js',
format: 'cjs'
},
plugins: [
preserveDirectives()
]
}
```
This plugin exposes the result of its directives information of current file for other plugins to use. You can access it via `this.getModuleInfo` or the `moduleParsed` hook.
```ts
// `meta` property info
{
preserveDirectives: {
directives: string[]
shebang: string
}
}
```
MIT