callstack / repack

A Webpack-based toolkit to build your React Native application with full support of Webpack ecosystem.
https://re-pack.dev
MIT License
1.48k stars 110 forks source link

Unhandled js exception [Reanimated] #701

Closed songdedku closed 2 months ago

songdedku commented 3 months ago

Describe the bug

Screenshot 2567-08-21 at 21 18 39 Screenshot 2567-08-21 at 21 18 27

System Info

rules: [
        {
          test: /\.[cm]?[jt]sx?$/,
          include: [
            // Include all node_modules except localforage
            /node_modules(?!\/localforage)/,
          ],
          // include: [
          //   /node_modules(.*[/\\])+react/,
          //   /node_modules(.*[/\\])+@react-native/,
          //   /node_modules(.*[/\\])+@react-navigation/,
          //   /node_modules(.*[/\\])+@react-native-community/,
          //   /node_modules(.*[/\\])+@expo/,
          //   /node_modules(.*[/\\])+pretty-format/,
          //   /node_modules(.*[/\\])+metro/,
          //   /node_modules(.*[/\\])+abort-controller/,
          //   /node_modules(.*[/\\])+@callstack\/repack/,
          //   /node_modules(.*[/\\])+nativewind/,
          //   /node_modules(.*[/\\])+axios/,
          //   /node_modules(.*[/\\])+semver/,
          //   /node_modules(.*[/\\])+nonaid/,
          //   /node_modules(.*[/\\])+superstruct/,
          //   /node_modules(.*[/\\])+@sentry/,
          //   /node_modules(.*[/\\])+@firebase/,
          //   /node_modules(.*[/\\])+lottie-react-native/,
          // ],
          // include: /node_modules/, // Include all files in node_modules
          use: 'babel-loader',
          type: 'javascript/dynamic',
        },
        {
          test: /\.[jt]sx?$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: {
              plugins:
                devServer && devServer.hmr
                  ? ['module:react-refresh/babel']
                  : undefined,
            },
          },
        },
        {
          test: /\.tsx?$/,
          use: [
            {
              loader: 'ts-loader',
              options: {
                transpileOnly: true,
              },
            },
          ],
        },
        {
          test: /\.(js|jsx)$/, // Matches .js and .jsx files
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-env', '@babel/preset-react'],
              plugins: ['@babel/plugin-transform-runtime'],
            },
          },
        },
        {
          test: /\.lottie$/,
          type: 'asset/resource',
        },
        {
          test: Repack.getAssetExtensionsRegExp(Repack.ASSET_EXTENSIONS),
          use: {
            loader: '@callstack/repack/assets-loader',
            options: {
              platform,
              devServerEnabled: Boolean(devServer),
              scalableAssetExtensions: Repack.SCALABLE_ASSETS,
            },
          },
        },
      ],

Re.Pack Version

4.2.0

Reproduction

No response

Steps to reproduce

No response

songdedku commented 3 months ago

my babel config module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: [ [ 'babel-plugin-root-import', { rootPathPrefix: '~', rootPathSuffix: 'src', }, ], 'nativewind/babel', 'react-native-reanimated/plugin', [ '@babel/plugin-transform-class-properties', {loose: true}, // Ensure loose mode is set to true ], [ '@babel/plugin-transform-private-methods', {loose: true}, // Ensure loose mode is set to true ], [ '@babel/plugin-transform-private-property-in-object', {loose: true}, // Ensure loose mode is set to true ], ], };

jbroma commented 3 months ago

Hi @songdedku,

please provide a minimal reproduction repository where the error is happening, otherwise I won't be able to help you with this issue.

songdedku commented 3 months ago

error when I have import react-native-reanimated-carousel or @react-navigation/drawer on screen @jbroma

jbroma commented 3 months ago

@songdedku please make a repo that I can clone so I can help you, thanks!

songdedku commented 3 months ago

I think it might be because of this warning.

Screenshot 2567-08-24 at 02 36 07

https://github.com/songdedku/testRepack.git @jbroma , thanks!

songdedku commented 2 months ago

I'm tired of fixing it. Please help me. Thank you. @jbroma

artus9033 commented 2 months ago

Hi @songdedku, we investigated your issue. The warning you mentioned is harmless, however, there exist a few problems in your setup:

After applying both changes, running the start script first and then the app, your project worked properly.