-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.cjs
More file actions
33 lines (32 loc) · 919 Bytes
/
rollup.config.cjs
File metadata and controls
33 lines (32 loc) · 919 Bytes
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
const { withNx } = require('@nx/rollup/with-nx');
module.exports = withNx(
{
main: './src/index.ts',
outputPath: './dist',
tsConfig: './tsconfig.lib.json',
compiler: 'babel',
format: ['esm', 'cjs'],
},
{
// Ensure React and React Native are treated as external dependencies
external: (id) => {
// Mark React and React Native modules as external
if (id === 'react' || id === 'react-native' || id === 'react/jsx-runtime') {
return true;
}
// Mark any imports from react as external (like react/jsx-runtime, etc.)
if (id.startsWith('react/') || id.startsWith('react-native/')) {
return true;
}
return false;
},
output: {
// Ensure React imports are properly mapped
globals: {
'react': 'React',
'react-native': 'ReactNative',
'react/jsx-runtime': 'ReactJSXRuntime'
}
}
}
);