javascript-obfuscator / javascript-obfuscator/react-native-obfuscating-transformer

TypeError: Cannot read property 'transformFile' of undefined

Open
#16 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
211
Forks
102
PR merge metrics
No merged PRs in 30d

Description

**Versions**:

"react-native": "0.59.10",
"react-native-obfuscating-transformer": "^1.0.0",

**Files**:

metro.config.js:

```js
module.exports = {
transformer: {
babelTransformerPath: require.resolve("./transformer"),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
```

transformer.js:

```js
const obfuscatingTransformer = require('react-native-obfuscating-transformer')

module.exports = obfuscatingTransformer({})
```

**Error I am getting:**

```sh
Loading dependency graph, done.
Loading dependency graph...error Cannot read property 'transformFile' of undefined
debug TypeError: Cannot read property 'transformFile' of undefined
at /home/chris/Documents/JSObfuscation/ObfuscationTest/node_modules/metro/src/Bundler.js:83:34
at Generator.next ()
at asyncGeneratorStep (/home/chris/Documents/JSObfuscation/ObfuscationTest/node_modules/metro/src/Bundler.js:14:24)
at _next (/home/chris/Documents/JSObfuscation/ObfuscationTest/node_modules/metro/src/Bundler.js:34:9)
```

**Repo**

Simplest repo I could make that reproduces this error:

[https://github.com/ExoMemphiz/ObfuscationTest/](https://github.com/ExoMemphiz/ObfuscationTest/)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the linked ObfuscationTest reproduction and begin with metro.config.js and transformer.js. Inspect the transformer entry point alongside node_modules/metro/src/Bundler.js:83 to determine why transformFile is unavailable, then verify that the dependency graph loads without this error on React Native 0.59.10.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.