Expo & Fast refresh no longer working

Hello!
I’ve been unable to get Fast Refresh working for my (relatively simple) project. It occasionally worked in the beginning, and now the only way I can trigger a refresh is a full tsc --build (which then takes me back to my initial react-navigation route. ew.). I’m at a complete loss as to what triggers the refresh - so I’m flying a bit blind on what to look into/how to fix it. Any help would be DEEPLY appreciated!

TSConfig:

{
    "compilerOptions": {
        "jsx": "react",
        "module": "commonjs",
        "target": "es6",
        "sourceMap": true,
        "esModuleInterop": true,
        "moduleResolution": "node",
        "baseUrl": "./app",
        "paths": {
            "components/*": [ "./components/*" ],
            "lib/*": [ "./lib/*" ],
            "@app/*": [
                "*"
            ]
        }
    },
    "exclude": [
        "node_modules"
    ]
}

Metro config:

module.exports = {
    resolver: {
        blacklistRE: blacklist([/amplify\/#current-cloud-backend\/.*/]),
        sourceExts: ["scss", "sass"],
    },
    transformer: {
        babelTransformerPath: require.resolve("react-native-sass-transformer"),
        getTransformOptions: async () => ({
            transform: {
                experimentalImportSupport: false,
                inlineRequires: false,
            },
        }),
    },
    watchFolders: ['./app'],
};

Expo CLI 3.11.1 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.8.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338

  1. you shouldn’t need to use tsc to build at all. metro can load ts directly and just strips them out
  2. watchFolders and sourceExts look like they could be problematic.

i’d suggest trying to create a new project then slowly add your config, restarting and clearing the cache each time, until you find the piece that causes this problem

Thank you for the help! I stripped out watchFolders / sourceExts and it didn’t fix the issue. Spent the last day futzing with things but nothing worked.

As a sanity check I ended up starting with a fresh ‘expo init’ – dropped all of my files in there + modules – aaaaaand it worked(?!) Unsure what got screwed up…but sometimes you just have to try rebooting it.

Appreciate the gentle nudge in the right direction.

1 Like