Skip to content

Instantly share code, notes, and snippets.

@betomoedano
Created December 17, 2025 16:01
Show Gist options
  • Select an option

  • Save betomoedano/eb0a7c9a544f0c0bc4494c0a0bfdb892 to your computer and use it in GitHub Desktop.

Select an option

Save betomoedano/eb0a7c9a544f0c0bc4494c0a0bfdb892 to your computer and use it in GitHub Desktop.
React Compiler cannot run on widget files because they are invoked outside React.
const path = require("path");
module.exports = function (api) {
api.cache(true);
const widgetDir = path.join(__dirname, "widget") + path.sep;
const normalizedWidgetDir = widgetDir.replace(/\\/g, "/");
return {
presets: [
[
"babel-preset-expo",
{
// React Compiler cannot run on widget files because they are invoked outside React.
"react-compiler": {
sources: (filename) => {
if (!filename) {
return true;
}
const normalizedFile = filename.replace(/\\/g, "/");
return !normalizedFile.startsWith(normalizedWidgetDir);
},
},
},
],
],
plugins: ["react-native-reanimated/plugin"],
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment