Like rollup-plugin-image, but writes image files to dest instead of inlining base64. This was written for a library that would be consumed by react-native applications.
Install the plugin via npm:
npm install --save-dev rollup-plugin-image-files
Add the plugin to your rollup config:
import images from 'rollup-plugin-image-files';
export default {
entry: 'src/index.js',
des: 'dist/bundle.js',
plugins: [images()]
}
Require some images in your source:
import React from 'react';
import { Image } from 'react-native';
import imageSrc from '../path/to/image.png';
export default const MyComponent = () => (
<Image source={imageSrc}/>
);
The plugin does two things: