Before submitting a new issue
Bug summary
Hello, i was trying to make polygen work in my Expo project and when i try to build my project using expo run:android i got the following error:
> Task :callstack_polygen:compileDebugKotlin FAILED
e: file:///home/iyari/Documents/Code/Menta/App/node_modules/@callstack/polygen/android/src/main/java/com/wasm/WasmModule.kt:10:3 'getName' overrides nothing
e: file:///home/iyari/Documents/Code/Menta/App/node_modules/@callstack/polygen/android/src/main/java/com/wasm/WasmModule.kt:17:3 'multiply' overrides nothing
e: file:///home/iyari/Documents/Code/Menta/App/node_modules/@callstack/polygen/android/src/main/java/com/wasm/WasmPackage.kt:12:41 Type mismatch: inferred type is WasmModule but NativeModule? was expected
e: file:///home/iyari/Documents/Code/Menta/App/node_modules/@callstack/polygen/android/src/newarch/WasmSpec.kt:6:3 Unresolved reference: NativeWasmSpec
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':callstack_polygen:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
So i followed the readme and i got the error mentioned above. My RN version is 0.76.9 with new architecture (expo ^52.0.46). I dont even know what is causing the issue. So i hope you can help me to understand better what's happening.
Library version
^0.2.1
Environment info
System:
OS: Linux 6.14 Fedora Linux 42 (Workstation Edition)
CPU: (12) x64 AMD Ryzen 5 5600 6-Core Processor
Memory: 856.47 MB / 15.50 GB
Shell:
version: 5.2.37
path: /bin/bash
Binaries:
Node:
version: 22.14.0
path: ~/.nvm/versions/node/v22.14.0/bin/node
Yarn: Not Found
npm:
version: 10.9.2
path: ~/.nvm/versions/node/v22.14.0/bin/npm
Watchman:
version: 2025.03.10.00
path: /home/linuxbrew/.linuxbrew/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.9
path: /home/iyari/.sdkman/candidates/java/current/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: latest
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.9
wanted: 0.76.9
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Steps to reproduce
- sudo dnf install wabt
- npx @callstack/polygen init
- selected yes
- then i updated the config file:
import {
localModule,
polygenConfig,
} from '@callstack/polygen-config';
/**
* @type {import('@callstack/polygen/config').PolygenConfig}
*/
export default polygenConfig({
/**
* Output configuration
*/
output: {
/**
* Directory where the output files will be stored.
*/
// directory: 'node_modules/.polygen-out'
},
/**
* Configuration for the `scan` command.
*/
scan: {
/**
* List of paths to scan for modules.
*
* Each item is a glob pattern that can use wildcards, or be used
* to ignore specific element by prefixing it by `!`.
*/
// paths: [
// "src/**/*.wasm",
// ]
},
/**
* List of modules to be used in the project.
*
* Each module can be individually configured, by passing options object as a second
* argument (or 3rd, for external modules).
*/
modules: [
// localModule('src/wasm/module.wasm')
localModule('node_modules/evmole/dist/evmole_bg.wasm')
],
});
✔ Scanning for WebAssembly modules
ℹ Found 0 WebAssembly module(s) 0 new, 1 removed
ℹ Generating code for 1 WebAssembly module(s) 07:46:01
✔ Processing local module node_modules/evmole/dist/evmole_bg.wasm
ℹ Found 30 imports (30 functions, 0 memories, 0 globals, 0 tables) 07:46:01
ℹ Found 18 exports (16 functions, 1 memories, 0 globals, 1 tables) 07:46:01
✔ Generating host module
✔ Generated import wbg bridge 07:46:01
ℹ Run pod install to regenerate XCode project and make sure new source files are included 07:46:01
- Added polyfills in imports
- npm i -D @callstack/polygen-metro-config
- updated metro.config:
const { getDefaultConfig } = require("expo/metro-config");
const { withPolygenConfig } = require('@callstack/polygen-metro-config');
module.exports = (() => {
const config = getDefaultConfig(__dirname);
const { transformer, resolver } = config;
// Configures the transformer to handle SVG files using react-native-svg-transformer.
// This allows importing SVGs as React components.
config.transformer = {
...transformer,
babelTransformerPath: require.resolve("react-native-svg-transformer/expo"),
};
config.resolver = {
// Configures the module resolver.
// - unstable_enablePackageExports: Enables support for "exports" in package.json (needed for some dependencies).
// - assetExts: Excludes 'svg' from default asset extensions as we treat them as source code.
// - sourceExts: Adds 'svg' to source file extensions so Metro processes them via the transformer.
...resolver,
unstable_enablePackageExports: true,
assetExts: resolver.assetExts.filter((ext) => ext !== "svg"),
sourceExts: [...resolver.sourceExts, "svg"],
extraNodeModules: {
...resolver.extraNodeModules,
},
};
return withPolygenConfig(config);
})();
And run npx expo run:android.
Reproducible sample code
It's not a bug in the code but in the setup. The only way to reproduce is to install the module in my version of expo and RN.
Before submitting a new issue
Bug summary
Hello, i was trying to make polygen work in my Expo project and when i try to build my project using expo run:android i got the following error:
So i followed the readme and i got the error mentioned above. My RN version is 0.76.9 with new architecture (expo ^52.0.46). I dont even know what is causing the issue. So i hope you can help me to understand better what's happening.
Library version
^0.2.1
Environment info
System: OS: Linux 6.14 Fedora Linux 42 (Workstation Edition) CPU: (12) x64 AMD Ryzen 5 5600 6-Core Processor Memory: 856.47 MB / 15.50 GB Shell: version: 5.2.37 path: /bin/bash Binaries: Node: version: 22.14.0 path: ~/.nvm/versions/node/v22.14.0/bin/node Yarn: Not Found npm: version: 10.9.2 path: ~/.nvm/versions/node/v22.14.0/bin/npm Watchman: version: 2025.03.10.00 path: /home/linuxbrew/.linuxbrew/bin/watchman SDKs: Android SDK: Not Found IDEs: Android Studio: Not Found Languages: Java: version: 17.0.9 path: /home/iyari/.sdkman/candidates/java/current/bin/javac Ruby: Not Found npmPackages: "@react-native-community/cli": installed: 18.0.0 wanted: latest react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.76.9 wanted: 0.76.9 npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: Not found newArchEnabled: falseSteps to reproduce
And run npx expo run:android.
Reproducible sample code
It's not a bug in the code but in the setup. The only way to reproduce is to install the module in my version of expo and RN.