diff --git a/next.config.ts b/next.config.ts index 492dee7..68ca566 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,4 +1,5 @@ import type { NextConfig } from "next"; + import packageJson from "./package.json" with { type: "json" }; const transpilePackages = [ @@ -9,6 +10,12 @@ const transpilePackages = [ ), ]; const nextConfig: NextConfig = { + transpilePackages, + + env: { + ENV: process.env.NODE_ENV, + }, + experimental: { turbo: { rules: { @@ -42,10 +49,32 @@ const nextConfig: NextConfig = { ], }, }, - transpilePackages, - env: { - ENV: process.env.NODE_ENV, + webpack: (config, { webpack }) => { + // react-native packages requires often global __DEV__ constant + config.plugins.push( + new webpack.DefinePlugin({ + __DEV__: process.env.NODE_ENV === "production" || true, + }) + ); + + // react-native-web + config.resolve.alias = { + ...(config.resolve.alias || {}), + // Transform all direct `react-native` imports to `react-native-web` + "react-native$": "react-native-web", + }; + config.resolve.extensions = [ + ".web.js", + ".web.ts", + ".web.tsx", + ...config.resolve.extensions, + ]; + + // avoid duplicated react + // config.resolve.alias['react'] = path.resolve(__dirname, '.', 'node_modules', 'react'); + + return config; }, }; diff --git a/package-lock.json b/package-lock.json index e9328c5..9915da6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "react": "19.0.0-rc-66855b96-20241106", "react-dom": "19.0.0-rc-66855b96-20241106", "react-native-gesture-handler": "^2.21.2", + "react-native-reanimated": "^3.16.3", "react-native-safe-area-context": "^4.14.0", "react-native-svg": "^15.9.0", "react-native-web": "^0.19.13", @@ -38,6 +39,9 @@ "react-native": "^0.76.2", "string-replace-loader": "^3.1.0", "typescript": "^5" + }, + "engines": { + "node": "22.x" } }, "node_modules/@ampproject/remapping": { @@ -1757,7 +1761,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz", "integrity": "sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, @@ -11196,6 +11199,30 @@ "react-native": "*" } }, + "node_modules/react-native-reanimated": { + "version": "3.16.3", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.3.tgz", + "integrity": "sha512-OWlA6e1oHhytTpc7WiSZ7Tmb8OYwLKYZz29Sz6d6WAg60Hm5GuAiKIWUG7Ako7FLcYhFkA0pEQ2xPMEYUo9vlw==", + "license": "MIT", + "dependencies": { + "@babel/plugin-transform-arrow-functions": "^7.0.0-0", + "@babel/plugin-transform-class-properties": "^7.0.0-0", + "@babel/plugin-transform-classes": "^7.0.0-0", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.0.0-0", + "@babel/plugin-transform-optional-chaining": "^7.0.0-0", + "@babel/plugin-transform-shorthand-properties": "^7.0.0-0", + "@babel/plugin-transform-template-literals": "^7.0.0-0", + "@babel/plugin-transform-unicode-regex": "^7.0.0-0", + "@babel/preset-typescript": "^7.16.7", + "convert-source-map": "^2.0.0", + "invariant": "^2.2.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0", + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native-safe-area-context": { "version": "4.14.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-4.14.0.tgz", @@ -15042,7 +15069,6 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz", "integrity": "sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==", - "peer": true, "requires": { "@babel/helper-plugin-utils": "^7.25.9" } @@ -21536,6 +21562,24 @@ "prop-types": "^15.7.2" } }, + "react-native-reanimated": { + "version": "3.16.3", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.3.tgz", + "integrity": "sha512-OWlA6e1oHhytTpc7WiSZ7Tmb8OYwLKYZz29Sz6d6WAg60Hm5GuAiKIWUG7Ako7FLcYhFkA0pEQ2xPMEYUo9vlw==", + "requires": { + "@babel/plugin-transform-arrow-functions": "^7.0.0-0", + "@babel/plugin-transform-class-properties": "^7.0.0-0", + "@babel/plugin-transform-classes": "^7.0.0-0", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.0.0-0", + "@babel/plugin-transform-optional-chaining": "^7.0.0-0", + "@babel/plugin-transform-shorthand-properties": "^7.0.0-0", + "@babel/plugin-transform-template-literals": "^7.0.0-0", + "@babel/plugin-transform-unicode-regex": "^7.0.0-0", + "@babel/preset-typescript": "^7.16.7", + "convert-source-map": "^2.0.0", + "invariant": "^2.2.4" + } + }, "react-native-safe-area-context": { "version": "4.14.0", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-4.14.0.tgz", diff --git a/package.json b/package.json index f9ef2c1..6d26aa8 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "react": "19.0.0-rc-66855b96-20241106", "react-dom": "19.0.0-rc-66855b96-20241106", "react-native-gesture-handler": "^2.21.2", + "react-native-reanimated": "^3.16.3", "react-native-safe-area-context": "^4.14.0", "react-native-svg": "^15.9.0", "react-native-web": "^0.19.13",