forked from dream-sports-labs/react-native-fast-image
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.cjs
30 lines (29 loc) · 1.03 KB
/
rollup.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const resolve = require('@rollup/plugin-node-resolve')
const commonjs = require('@rollup/plugin-commonjs')
const typescript = require('@rollup/plugin-typescript')
const { terser } = require('rollup-plugin-terser')
const json = require('@rollup/plugin-json')
const pkg = require('./package.json')
module.exports = {
input: 'src/index.tsx', // Entry point of your library
output: [
{
file: pkg.main, // CommonJS format
format: 'cjs',
},
{
file: pkg.module, // ES module format
format: 'esm',
},
],
external: ['react', 'react-native'], // Exclude peer dependencies
plugins: [
resolve({ extensions: ['.js', '.jsx', '.ts', '.tsx'] }), // Resolves node modules
commonjs(), // Converts CommonJS modules to ES6
typescript({
tsconfig: './tsconfig.json',
}), // Transpiles TypeScript to JavaScript
terser(), // Minifies the code for production
json(), // Allows Rollup to import JSON files
],
}