I have a Node app that uses Webpack and deploys to a Azure App service using azure/webapps-deploy@v2
when calling the webpack function , I get this error. How can I address the heap limit issue.
package versions:
"webpack": "^5.87.0",
"webpack-cli": "^5.1.4"
webpack.config.js
const path = require('path');
module.exports = {
mode: 'production',
parallelism: 4,
entry:{
about: './dist/app/about.js', accessibleGallery: './dist/app/accessibleGallery.js', assets: './dist/app/assets.js', avatarSelector: './dist/app/avatarSelector.js', create: '/dist/app/create2.js', customizeModal: '/dist/app/customizeModal.js', data: '/dist/app/data.js', gallery: '/dist/app/gallery.js', galleries: '/dist/app/galleries.js', galleryBrowse: '/dist/app/galleryBrowse.js', home: '/dist/app/Home.js', keywords: '/dist/app/keywords.js', layout: '/dist/app/layout.js', login: '/dist/app/login.js', map: '/dist/app/map.js', mapPage: '/dist/app/mapPage.js', mygalleries: '/dist/app/mygalleries.js', sculptureEditor: '/dist/app/sculptureEditor.js', sculptureEditor2: '/dist/app/sculptureEditor2.js', settings: '/dist/app/settings.js', storybook: '/dist/app/storybook.js', subscribe: '/dist/app/subscribe.js', taskpane: '/dist/app/taskpane.js', teamsConfig: '/dist/app/teamsConfig.js', teamsDialog: '/dist/app/teamsDialog.js', teamsGalleries: '/dist/app/teamsGalleries.js', teamsLoggedIn: '/dist/app/teamsLoggedIn.js', teamsLoggingIn: "/dist/app/teamsLoggingIn.js", teamsStage: '/dist/app/teamsStage.js', visitorMap: '/dist/app/visitorMap.js' },
output: {
clean: true,
filename: '[name].bundle.js',
library: ["Galeryst", '[name]'], path: path.resolve(__dirname, 'public/js'), publicPath: '' }, };
Thanks in advance,
Michael
webpack
114
115
116<--- Last few GCs --->
117
118[2097:0x7295f70] 521013 ms: Mark-sweep 1603.8 (1687.6) -> 1589.5 (1689.3) MB, 6164.9 / 0.0 ms (average mu = 0.510, current mu = 0.226) allocation failure; scavenge might not succeed
119[2097:0x7295f70] 527654 ms: Mark-sweep 1606.2 (1689.8) -> 1592.5 (1692.1) MB, 6374.7 / 0.0 ms (average mu = 0.314, current mu = 0.040) allocation failure; scavenge might not succeed
120
121
122<--- JS stacktrace --->
123
124FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
125 1: 0xb7a940 node::Abort() [webpack]
126 2: 0xa8e823 [webpack]
127 3: 0xd5c940 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [webpack]
128 4: 0xd5cce7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [webpack]
129 5: 0xf3a3e5 [webpack]
130 6: 0xf4c8cd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [webpack]
131 7: 0xf26fce v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [webpack]
132 8: 0xf28397 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [webpack]
133 9: 0xf0956a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [webpack]
13410: 0x12ce7af v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [webpack]
13511: 0x16fb6b9 [webpack]
136Aborted (core dumped)
137npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated\nnpm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated\nnpm WARN deprecated har-validator@5.1.5: this library is no longer supported\nnpm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated\nnpm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated\nnpm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.\nnpm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.\nnpm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies\nnpm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.\nnpm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\nnpm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\nnpm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\nnpm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\nnpm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\nnpm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.\nnpm WARN deprecated @types/bingmaps@0.0.1: deprecated\nnpm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142\nnpm WARN deprecated messageformat@2.3.0: Package renamed as '@messageformat/core', see messageformat.github.io for more details. 'messageformat@4' will eventually provide a polyfill for Intl.MessageFormat, once it's been defined by Unicode & ECMA.\nnpm WARN deprecated azure-storage@2.10.3: Please note: newer packages @azure/storage-blob, @azure/storage-queue and @azure/storage-file are available as of November 2019 and @azure/data-tables is available as of June 2021. While the legacy azure-storage package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Migration guide can be found: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/MigrationGuide.md\nnpm WARN deprecated azure-storage@2.10.7: Please note: newer packages @azure/storage-blob, @azure/storage-queue and @azure/storage-file are available as of November 2019 and @azure/data-tables is available as of June 2021. While the legacy azure-storage package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Migration guide can be found: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/MigrationGuide.md\n\n<--- Last few GCs --->\n\n[2097:0x7295f70] 521013 ms: Mark-sweep 1603.8 (1687.6) -> 1589.5 (1689.3) MB, 6164.9 / 0.0 ms (average mu = 0.510, current mu = 0.226) allocation failure; scavenge might not succeed\n[2097:0x7295f70] 527654 ms: Mark-sweep 1606.2 (1689.8) -> 1592.5 (1692.1) MB, 6374.7 / 0.0 ms (average mu = 0.314, current mu = 0.040) allocation failure; scavenge might not succeed\n\n\n<--- JS stacktrace --->\n\nFATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory\n 1: 0xb7a940 node::Abort() [webpack]\n 2: 0xa8e823 [webpack]\n 3: 0xd5c940 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [webpack]\n 4: 0xd5cce7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [webpack]\n 5: 0xf3a3e5 [webpack]\n 6: 0xf4c8cd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [webpack]\n 7: 0xf26fce v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [webpack]\n 8: 0xf28397 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [webpack]\n 9: 0xf0956a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [webpack]\n10: 0x12ce7af v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [webpack]\n11: 0x16fb6b9 [webpack]\nAborted (core dumped)\n/bin/bash -c "oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 18 -p virtualenv_name= --log-file /tmp/build-debug.log -i /tmp/8db71d1eec2de0f -p compress_node_modules=tar-gz | tee /tmp/oryx-build.log ; exit $PIPESTATUS "
138