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

Failed to load: React Scan #402

Open
Barzi-Ahmed opened this issue Jan 10, 2025 · 0 comments
Open

Failed to load: React Scan #402

Barzi-Ahmed opened this issue Jan 10, 2025 · 0 comments

Comments

@Barzi-Ahmed
Copy link

Barzi-Ahmed commented Jan 10, 2025

Hi,
After enabling react scan, it seems it doesn't work. Following error in chrome devtools appears:

[React Scan] Failed to load. Must import React Scan before React runs

Template: Minimal Tamagui

This is my package.json

{
	"name": "myapp",
	"version": "1.1.388",
	"private": true,
	"type": "module",
	"scripts": {
		"android": "one run:android",
		"build:web": "one build",
		"clean": "one clean",
		"dev": "one dev",
		"dev:clean": "one dev --clean",
		"ios": "one run:ios",
		"prebuild:native": "one prebuild",
		"serve": "one serve",
		"upgrade:tamagui": "$npm_execpath up '*tamagui*' '@tamagui/*'"
	},
	"dependencies": {
		"@tamagui/animations-css": "^1.121.7",
		"@tamagui/animations-moti": "^1.121.7",
		"@tamagui/colors": "^1.121.7",
		"@tamagui/image-next": "^1.121.7",
		"@tamagui/react-native-media-driver": "^1.121.7",
		"@tamagui/shorthands": "^1.121.7",
		"expo": "~52.0.24",
		"expo-font": "^13.0.2",
		"expo-modules-core": "2.1.2",
		"one": "1.1.393",
		"react": "^19.0.0",
		"react-native": "^0.76.6",
		"react-native-reanimated": "~3.16.6",
		"react-native-safe-area-context": "4.10.5",
		"react-native-screens": "4.4.0",
		"react-native-svg": "15.8.0",
		"react-native-web": "^0.19.13",
		"tamagui": "^1.121.7"
	},
	"devDependencies": {
		"@react-native-community/cli": "15.1.3",
		"@tamagui/vite-plugin": "^1.121.7",
		"@types/react": "^18.3.18",
		"vite": "^6.0.7"
	}
}

My vite.config.ts:

import type { UserConfig } from 'vite'
import { one } from 'one/vite'
import { tamaguiPlugin } from '@tamagui/vite-plugin'

export default {
	plugins: [
		one({
			react: {
				compiler: process.env.NODE_ENV === 'production',
				scan: true ,
			},

			web: {
				defaultRenderMode: 'ssr',
			},

			app: {
				key: 'fuga',
			},

			server: {
				platform:  'vercel'
			  },
		}),

		tamaguiPlugin({
			optimize: process.env.NODE_ENV === 'production',
			components: ['tamagui'],
			config: './src/tamagui/tamagui.config.ts',
			outputCSS: './src/tamagui/tamagui.css',
		}),
	],
} satisfies UserConfig

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

1 participant