callstack / react-native-builder-bob

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets

Home Page:https://callstack.github.io/react-native-builder-bob/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build bug with version 0.20.4

oliviercperrier opened this issue · comments

Description

I get build error when using expo web with the new 0.20.4 version of bob.

This is the error:

Module parse failed: Unexpected token (10:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     this.targetApp = targetApp;
|   }
>   logClientError = async error => {
|     const genericDetails = await this.getGenericLogDetails();
|     this.usersApi.createErrorLog({

With version 0.20.3, the generated code looked like this:

_defineProperty(this, "logClientError", async error => {
      const genericDetails = await this.getGenericLogDetails();
      this.usersApi.createErrorLog({
        metadata: {
          stack: (error === null || error === void 0 ? void 0 : error.stack) || null,
          message: (error === null || error === void 0 ? void 0 : error.message) || null,
          cause: (error === null || error === void 0 ? void 0 : error.cause) || null,
          name: (error === null || error === void 0 ? void 0 : error.name) || null
        },
        ...genericDetails
      });
    });

now with version 0.20.4, it looks like this:

logClientError = async error => {
    const genericDetails = await this.getGenericLogDetails();

    this.usersApi.createErrorLog({
      metadata: {
        stack: error?.stack || null,
        message: error?.message || null,
        cause: error?.cause || null,
        name: error?.name || null,
      },
      ...genericDetails,
    });
  };

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

  "react-native-builder-bob": {
    "source": "src",
    "output": "dist",
    "targets": [
      "commonjs",
      "module",
      "typescript"
    ]
  },

Link to repro

No response

Environment

System:
OS: macOS 13.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 1.81 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^18.1.0 => 18.1.0
react-native: ^0.70.6 => 0.70.7
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Hey, can you try with the latest version of create-react-native-library?