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

Failed production runtime build

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.59": "0.18.0",
"react-native": "0.59.10",
"webpack": "4.41.5",

Description

The application starts and works, but crashes on some functions. I managed to find out that if you force the concatenateModules in optimization defaultConfig in haul to be disabled, then everything works.

optimization: {
minimize: true,
minimizer: [new _terserWebpackPlugin.default({
test: /.(js|(js)?bundle)($|?)/i,
cache: true,
// Set upper limit on CPU cores, to prevent Out of Memory exception on CIs.
parallel: _isCi.default ? Math.min(_os.default.cpus().length, 8) - 1 : true,
sourceMap: false
})],
namedModules: dev,
concatenateModules: false
},

Reproducible Demo

image

commented

Babel config

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

return {
    sourceType: "unambiguous",
    presets: [
        "module:@haul-bundler/babel-preset-react-native",
    ],
    plugins: [
        "react-require",
        "lodash",
        "./babel-plugin-inject-to-lazy",
        ["@babel/plugin-transform-runtime", {
            helpers: true,
            regenerator: false,
        }],
    ],
    compact: api.env("production")
}
}

Does this happen if you change minimize to false in optimization??

commented

@zamotany No, when you turn off minification everything works

commented

After upgrading node from 10 to 12, it worked