forked from lazor-kit/wallet-mobile-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
88 lines (85 loc) · 1.92 KB
/
Copy pathrollup.config.js
File metadata and controls
88 lines (85 loc) · 1.92 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const typescript = require('rollup-plugin-typescript2');
const json = require('@rollup/plugin-json');
const resolve = require('@rollup/plugin-node-resolve');
const dts = require('rollup-plugin-dts');
import commonjs from '@rollup/plugin-commonjs';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
// Main build
const mainConfig = {
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
format: 'cjs',
sourcemap: true,
},
{
file: 'dist/index.esm.js',
format: 'es',
sourcemap: true,
},
],
external: [
'react',
'react-native',
'react-dom',
'@coral-xyz/anchor',
'@react-native-async-storage/async-storage',
'expo-web-browser',
'js-sha256',
'react-native-get-random-values',
'zustand',
'buffer',
'bs58',
'node-fetch',
'whatwg-url',
'@solana/web3.js',
'@solana/buffer-layout',
'@solana/codecs-numbers',
'borsh',
'rpc-websockets',
'@noble/hashes/sha256',
'util',
'http',
'https',
'zlib',
'stream',
'url',
],
plugins: [
peerDepsExternal({
includeDependencies: true,
}),
// Resolver must come first
resolve({
extensions: ['.js', '.ts', '.tsx'],
preferBuiltins: false,
}),
json(),
commonjs({
include: 'node_modules/',
requireReturnsDefault: 'auto',
}),
typescript({
tsconfig: './tsconfig.json',
useTsconfigDeclarationDir: false, // Let the plugin handle it directly
tsconfigOverride: {
compilerOptions: {
declaration: true,
declarationDir: 'dist',
emitDeclarationOnly: false,
},
},
}),
],
};
// Types config - separate step
const typesConfig = {
input: 'src/index.ts',
output: {
file: 'dist/index.d.ts',
format: 'es',
},
plugins: [dts.default()], // Use .default() for the plugin
};
module.exports = [mainConfig, typesConfig];