Skip to content

Commit 950c292

Browse files
authored
feat: package.json exports (#1431)
BREAKING CHANGE: package.json exports support
1 parent 114393c commit 950c292

File tree

5 files changed

+2014
-2196
lines changed

5 files changed

+2014
-2196
lines changed

babel.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
module.exports = {
2-
presets: ['@react-native/babel-preset'],
2+
overrides: [
3+
{
4+
exclude: /\/node_modules\//,
5+
presets: ['module:react-native-builder-bob/babel-preset'],
6+
},
7+
{
8+
include: /\/node_modules\//,
9+
presets: ['module:@react-native/babel-preset'],
10+
},
11+
],
312
};

example/babel.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
const path = require('path');
2+
const root = path.resolve(__dirname, '..');
3+
const pkg = require('../package.json');
4+
15
module.exports = {
2-
presets: ['@react-native/babel-preset'],
6+
presets: ['module:@react-native/babel-preset'],
7+
plugins: [
8+
[
9+
require.resolve('babel-plugin-module-resolver'),
10+
{
11+
extensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
12+
alias: {
13+
'@react-native-google-signin/google-signin': path.join(
14+
root,
15+
pkg.source,
16+
),
17+
},
18+
},
19+
],
20+
],
321
};

package.json

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
"name": "@react-native-google-signin/google-signin",
33
"version": "13.3.1",
44
"description": "Google sign in for your react native applications",
5-
"main": "lib/commonjs/index",
6-
"module": "lib/module/index",
7-
"types": "lib/typescript/src/index.d.ts",
8-
"react-native": "src/index",
9-
"source": "src/index",
5+
"main": "./lib/module/index.js",
6+
"types": "./lib/typescript/src/index.d.ts",
7+
"source": "./src/index.ts",
8+
"exports": {
9+
".": {
10+
"types": "./lib/typescript/src/index.d.ts",
11+
"default": "./lib/module/index.js"
12+
},
13+
"./app.plugin.js": "./app.plugin.js",
14+
"./package.json": "./package.json"
15+
},
1016
"files": [
1117
"src",
1218
"lib",
@@ -76,27 +82,28 @@
7682
"@semantic-release/git": "^10.0.1",
7783
"@types/jest": "^29.5.12",
7884
"@types/react": "^18.2.79",
85+
"babel-plugin-module-resolver": "^5.0.2",
7986
"eslint": "^8.57.0",
8087
"eslint-config-prettier": "^9.1.0",
8188
"eslint-plugin-ft-flow": "^3.0.7",
8289
"eslint-plugin-jest": "^28.5.0",
8390
"eslint-plugin-prettier": "^5.1.3",
84-
"expo": "^49.0.21",
85-
"expo-module-scripts": "^3.4.1",
91+
"expo": "^51.0.39",
92+
"expo-module-scripts": "^3.5.4",
8693
"husky": "^8.0.3",
8794
"jest": "^29.7.0",
8895
"patch-package": "^7.0.2",
8996
"pod-install": "^0.2.2",
9097
"prettier": "^3.2.5",
9198
"react": "18.2.0",
9299
"react-native": "^0.74.1",
93-
"react-native-builder-bob": "^0.23.2",
100+
"react-native-builder-bob": "^0.40.10",
94101
"react-native-test-app": "3.7.2",
95102
"semantic-release": "^22.0.12",
96103
"typescript": "^5.4.5"
97104
},
98105
"peerDependencies": {
99-
"expo": ">=50.0.0",
106+
"expo": ">=52.0.40",
100107
"react": "*",
101108
"react-dom": "*",
102109
"react-native": "*"
@@ -118,8 +125,12 @@
118125
"source": "src",
119126
"output": "lib",
120127
"targets": [
121-
"commonjs",
122-
"module",
128+
[
129+
"module",
130+
{
131+
"esm": true
132+
}
133+
],
123134
[
124135
"typescript",
125136
{

src/signIn/GoogleSignin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function configure(options: ConfigureParams = {}): void {
2424
if (options.offlineAccess && !options.webClientId) {
2525
throw new Error('RNGoogleSignin: offline use requires server web ClientID');
2626
}
27-
if ('androidClientId' in options) {
27+
if (__DEV__ && 'androidClientId' in options) {
2828
console.error(
2929
'RNGoogleSignIn: `androidClientId` is not a valid configuration parameter, please remove it.',
3030
);

0 commit comments

Comments
 (0)