scriptURL is null when building for Release with Xcode
See original GitHub issueCurrent Behavior
When building with the release build configuration in Xcode, I’m getting the following build error:
Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: null is not an object (evaluating 't.match(/(^.+)\/index/)[1]')
The error is referring to the minified version of this line, so it seems that NativeModules.SourceCode.scriptURL being imported from react-native is null.
I’m getting this when using haul version 1.0.0-beta-12. With 1.0.0-beta-11, it works just fine (it doesn’t include the line that is causing the error).
Expected Behavior
The build should complete without error as it does in beta-11.
Haul Configuration (webpack.haul.js)
const eslintFormatter = require('react-dev-utils/eslintFormatter')
const paths = require('./paths')
module.exports = ({ platform }, defaults) => ({
entry: `./index.js`,
module: {
...defaults.module,
rules: [
...defaults.module.rules,
{
test: /\.(js|jsx)$/,
enforce: 'pre',
use: [
{
options: {
formatter: eslintFormatter,
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
{
test: /\.graphql$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
},
],
},
})
Your Environment
| software | version |
|---|---|
| Haul | 1.0.0-beta-12 |
| react-native | 0.52.0 |
| node | 8.9.4 |
| npm or yarn | yarn |
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top Results From Across the Web
No script URL provided react native error - Apple Developer
Hello all, can't figure out the app crash it builds well and works in Debug mode, but in release modeit build but crashes...
Read more >react-native: 'RCTFatalException: No script URL provided
I am answering my own question. My problem has been solved by generating jsBundle using this command: react-native bundle --dev false --assets-dest ....
Read more >NULL Reference Exception in Xcode Build but not in Editor
However, when I build for iOS devices using Xcode and run the app, the variable "videoControlContainer" is always NULL.
Read more >macOS Ventura: can't launch build terminal
“buildapp.sh” can't be opened because (null) is not allowed to open documents in Terminal. ... macOS Ventura: SAB 10.1.1 doesn't find Xcode.
Read more >Managing Build Configurations in Xcode - Cocoacasts
A brand new Xcode project defines two build configurations, Debug and Release. Most projects define one ... 9, How to Encode Null Using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Makes sense that
scriptURLis not available in production. Changingglobal.DEV_SERVER_ORIGIN = scriptURL.match(/(^.+)\/index/)[1];toglobal.DEV_SERVER_ORIGIN = scriptURL ? scriptURL.match(/(^.+)\/index/)[1] : null;should fix the issue. What do you think @zamotany ?Not exactly because scriptUrl is always a string but regex not matched then we try to get [1] element form null and BOOM! I created PR to fix this.