question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.0.0-rc.7 dev server returns 404 with `platform=ios` param

See original GitHub issue

Current Behavior

When using Haul 1.0.0-rc.7 dev server with the iOS simulator, the bundle request returns a 404.

Expected Behavior

The bundle should load as it did in previous rcs (this worked in rc.6). Specifically, here are the list of commits leading up to the failure:

d795af385dfb5e3e8a2ef5ceb405aff8ab15933a -- working
6476292131bd440b30e65332a3d9ed008c80c51d -- working
2e3dcc1d27a9b456bb37923620d4c898bc8b38d1 -- not working

Haul Configuration (webpack.haul.js)

const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const SourceMapPlugin = require('source-map-loader');
const TSPlugin = require('ts-loader');
const BabelPlugin = require('babel-loader');

import { createWebpackConfig } from 'haul';

export default {
    webpack: env => {
        const config = createWebpackConfig((options) => ({
            entry: [path.resolve(__dirname, `./src/index.tsx`)],
        }))(env);

        config.output.path = path.join(__dirname, "dist");
        config.output.filename = `main.${env.platform}.bundle`;

        config.module = Object.assign(
            {},
            config.module,
            {
                rules: config.module.rules.concat([
                    {
                        test: /\.resx.js$/,
                        enforce: 'pre',
                        use: {
                            loader: '<MyLoader>',
                        }
                    },
                    {
                        test: /\.resx$/,
                        enforce: 'pre',
                        use: {
                            loader: '<MyLoader>',
                        },
                        exclude: [
                            /node_modules/
                        ]
                    },
                    {
                        test: /\.(ts|tsx)?$/,
                        include: [
                            path.resolve(__dirname, 'src')
                        ],
                        exclude: [
                            /node_modules/
                        ],
                        use: [
                            {
                                loader: 'source-map-loader'
                            },
                            {
                                loader: 'babel-loader'
                            },
                            {
                                loader: 'ts-loader',
                                options: {
                                    transpileOnly: true,
                                    experimentalWatchApi: true,
                                }
                            }
                        ],
                    }
                ])
            }
        );

        config.resolveLoader = {
            modules: [
                path.resolve(__dirname, "../build/tasks/loaders"),
                path.resolve(__dirname, './node_modules'),
            ]
        };

        config.resolve.extensions = [
            '.tsx',
            '.ts',
            '.${platform}.ts',
            '.${platform}.tsx',
            '.native.tsx',
            ...config.resolve.extensions
        ];

        return config;
    }
}

Your Environment

When removing the platform=ios param, the bundle request returns a 200, as expected, eg localhost:8081/dist/main.ios.bundle?dev=true&minify=false works whereas localhost:8081/dist/main.ios.bundle?dev=true&minify=false&platform=ios does not work.

software version
Haul 1.0.0-rc.7
react-native 0.55.4
node 8.9.4
npm or yarn pnpm 2.9.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
acoates-mscommented, Oct 10, 2018

Yes this should be fixed in rc8.

1reaction
greg-dovecommented, Sep 4, 2018

As an additional note: as a workaround for using rc7, I think the simplest option I can find to make this work is to change jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; to jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; inside AppDelegate.m

(Note the removal of ‘.ios’ here). However I assume that this should not be needed? (because it worked fine as it was previously)

And it seems that android is affected by exactly the same problem. To address this for rc.7 I made the following change inside the MainApplication.java (inside the local mReactNativeHost implementation) //change from default "index.android" to support haul rc.7+ @Override protected String getJSMainModuleName() { return "index"; }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack dev server returns 404 when landing to app
Webpack dev server returns 404 when landing not to index page. Problem is when landing example to localhost:8080/page app request bundle.js ...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >
SOAP-based API returning 404 and 500 HTTP status codes ...
Provides troubleshooting steps to an issue in which SOAP-based API is returning 404 and 500 HTTP status codes.
Read more >
How to Fix WordPress Posts Returning 404 Error - WPBeginner
Here is how you can easily fix the WordPress posts 404 error. ... Like the internal server error or error establishing database connection....
Read more >
Debugging the Spring MVC 404 “No mapping found for HTTP ...
As with any web application or website, Spring MVC returns the HTTP 404 response code when the requested resource can't be found.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found