-
-
Notifications
You must be signed in to change notification settings - Fork 40
env.uglify causes FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #458
Comments
Solved by increasing heap size. Might be worth mentioning in README.md or To allocate 4GB memory (or perhaps larger depending on app complexity): |
FWIW, I'm not seeing a significant size difference with uglify: Android iOS Snippet from my webpack.config.js:
|
Added workaround to deal with heap out of memory issues, which will happen for a reasonable sized app built on {N}. Please see NativeScript/nativescript-dev-webpack#458 **NOTE** Windows environment variable setting has not been tested by me - please confirm / verify it for Windows. macOS / Linux has been verified to work.
@NickIliev would be helpful to add a comment in webpack template which alerts the user the issue will only happen with --release flag. e.g.: // Work around an Android issue by setting compress = false, issue seen only when built with --release flag My updated snippet from webpack.config.js: if (uglify) {
config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));
// Work around an Android issue by setting compress = false, issue seen only when built with --release flag
const compress = platform !== "android";
config.plugins.push(new UglifyJsPlugin({
uglifyOptions: {
parallel: true,
cache: true,
mangle: { reserved: nsWebpack.uglifyMangleExcludes },
compress: compress
}
}));
} |
tns run and tns build work fine for both iOS and Android, with --bundle flag and --env.aot flag.
However, uglify fails with Out of Memory for both Android and iOS, all these commands fail during webpack build stage:
tns info:
grep webpack package.json:
From webpack.config.js:
Stacktrace:
The text was updated successfully, but these errors were encountered: