diff --git a/.changeset/fluffy-hornets-joke.md b/.changeset/fluffy-hornets-joke.md new file mode 100644 index 00000000..db3512ed --- /dev/null +++ b/.changeset/fluffy-hornets-joke.md @@ -0,0 +1,5 @@ +--- +"@react-native-async-storage/async-storage": patch +--- + +keep .js extension for react-native-web support diff --git a/packages/async-storage/package.json b/packages/async-storage/package.json index e0d2a092..d7b2bc0d 100644 --- a/packages/async-storage/package.json +++ b/packages/async-storage/package.json @@ -6,7 +6,7 @@ "types": "./lib/typescript/index.d.ts", "exports": { ".": { - "source": "./src/index.tsx", + "source": "./src/index.ts", "types": "./lib/typescript/index.d.ts", "default": "./lib/module/index.js" }, @@ -17,7 +17,7 @@ "build": "del-cli lib && bob build", "build:watch": "watch 'bob build' src", "test:ts": "tsc --noEmit", - "test:lint": "eslint src/*.{js,ts,tsx}" + "test:lint": "eslint src/*.{js,ts}" }, "files": [ "src", diff --git a/packages/async-storage/src/index.tsx b/packages/async-storage/src/index.native.ts similarity index 100% rename from packages/async-storage/src/index.tsx rename to packages/async-storage/src/index.native.ts diff --git a/packages/async-storage/src/index.ts b/packages/async-storage/src/index.ts new file mode 100644 index 00000000..647601ec --- /dev/null +++ b/packages/async-storage/src/index.ts @@ -0,0 +1,10 @@ +// note: .js extensions are kept to support react native web +import { getLegacyStorage } from "./createAsyncStorage.js"; + +export type { AsyncStorage } from "./AsyncStorage"; +export { createAsyncStorage } from "./createAsyncStorage.js"; + +export { AsyncStorageError } from "./AsyncStorageError"; + +// Legacy storage that is proxy to an old storage data. +export default getLegacyStorage();