Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importSource cannot be set when runtime is classic. Using Expo Blank Typescript template #3263

Open
2 of 6 tasks
trydalch opened this issue Nov 29, 2023 · 5 comments
Open
2 of 6 tasks

Comments

@trydalch
Copy link

trydalch commented Nov 29, 2023

Willing to submit a PR to fix?

  • I am willing to submit a PR to fix

Requested priority

Normal

Products/applications affected

No response

Package version(s)

npm 10.2.0

OS version(s)

Windows 11

Platform

  • iOS
  • macOS
  • win32
  • windows
  • android

Xcode version

No response

Please provide a reproduction of the bug

In a new project created using expo, I get get this error at bundle time when I've added the checkbox to my App.tsx.

Steps to reproduce:

npx create-react-app --template

Select Blank (Typescript)

npm i @fluentui/react-native

Then add the Checkbox:

import { StatusBar } from 'expo-status-bar';
import { Checkbox } from '@fluentui/react-native';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Open up App.tsx to start working on your app!</Text>
      <Checkbox label="Hello world checkbox" />
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Error in the console:

iOS Bundling failed 3487ms
error: node_modules\@fluentui-react-native\button\lib-commonjs\deprecated\Button.js: C:\Users\Trevor...\...\node_modules\@fluentui-react-native\button\lib-commonjs\deprecated\Button.js: importSource cannot be set when runtime is classic.
> 1 | "use strict";
    | ^
  2 | var __assign = (this && this.__assign) || function () {
  3 |     __assign = Object.assign || function(t) {
  4 |         for (var s, i = 1, n = arguments.length; i < n; i++) {

Oddly enough, I had just left the default babel.config.js, which didn't specify a compiler option. I tried setting it to automatic explicitly (because the error message led me to believe it had defaulted to classic). Got the same error. Setting it to classic made this error go away (which is the opposite of what I'd expect with the message).

I then found this related issue and got the checkbox rendered and the app bundled, but now I'm wondering if I'm going to have issues when I go to build a release version of the app: #2613

What's the best workaround for this?

Actual behavior

Unable to bundle and use the components.

Expected behavior

Bundling succeeds and it's actually usable with expo.

@trydalch
Copy link
Author

Another similar issue, though it complains about the runtime being set to automatic: #1891.

@ezesali
Copy link

ezesali commented Apr 9, 2024

Same here

@family2806
Copy link

same here

@asapMaki
Copy link

asapMaki commented Jun 7, 2024

Same

@mdecrocemovson
Copy link

same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants