callstack / haul

Haul is a command line tool for developing React Native apps, powered by Webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error hermesEnabled on Android

isuhar opened this issue · comments

commented

Environment

"@haul-bundler/babel-preset-react-native": "0.16.0",
"@haul-bundler/cli": "0.18.0",
"@haul-bundler/core": "0.18.0",
"@haul-bundler/preset-0.60": "0.18.0",
"react-native": "0.61.5",

Description

When turn on hermes on android, bundle dont work.
Adding plugins to babel configuration does not help. Not all functions look like this, only some of the node_modules. The metro bundler does not have such a library in the bundle.
This error is also reproduced in the examples in haul package.
First error when import module event-target-shim:

function defineRedirectDescriptor(key) {
return {
get() { <== here error in hermes
return pd(this).event[key]
},
set(value) {
pd(this).event[key] = value;
},
configurable: true,
enumerable: true,
}
}

Reproducible Demo

screenshot-2020-03-29_19 04 47 142

Add hermes: true to @haul-bundler/babel-preset-react-native in your Babel config. If that doesn't work, please reopen the issue.

commented

@zamotany
Yes, I did, but it only helps to remove line from defaultConfig in preset-0.60

exclude: /node_modules(?!.*[\/\\](react|@react-navigation|@react-native-community|@expo|pretty-format|@haul-bundler|metro))/,

Haul config:

export default makeConfig({
    bundles: {
        index: {
            entry: withPolyfills("./src/mobile/index"),
        },
    },
})

babel config:

module.exports = function(api) {
    api.cache.using(() => process.env.BABEL_ENV)

    return {
        presets: [
           ["module:@haul-bundler/babel-preset-react-native", {hermes: true}],
        ],
    }
}