Select to view content in your preferred language

@arcgis/core: Webpack build running out of memory when importing single ES6 Module

1733
5
04-08-2021 11:47 AM
avecchi
Emerging Contributor

Hello,

I have spun up a Create React Application and any time I import a single module from arcgis/core e.g:

 

import Graphic from '@arcgis/core/Graphic'

 


my build process runs out of memory.

 

I have also tried building the sample React app here:
https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app

and am getting the same issue.

 

I think it has something to do with Tree Shaking: https://webpack.js.org/guides/tree-shaking/

I'm pretty sure that by importing a single module it imports the entire arcgis/core dependency. I don't know if I'm not importing the modules correctly or if it isn't possible to import just the modules I need.

 

Is there something that I'm missing?

Thank you

5 Replies
ClémentLaskar
Regular Contributor

Hi,

Same for me, I'm not able to build my project anymore. Though I've sucessfully built https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app, I get around 250 js chunks with this sample... Using esri_loader I had around 5 chunks.

0 Kudos
avecchi
Emerging Contributor

Yeah I had to use esri-loader. I wonder if this has been fixed in the latest version of @arcgis/core

0 Kudos
HamzaAmdouni
New Contributor

Any updates about this one?

OlYoung
New Contributor

Any updates? Having a similar issue. I am building a component as part of a library, and that always ends up with 300 chunks, Ideally I would pack them straight into the single exported js file.

0 Kudos
tlepel
by
New Contributor

I'm having the same problem. I tried to use esri-loader instead, as @avecchi said they've been using that instead, but I couldn't get it to work.

The only (temprary) fix I could find was increasing the memory usage through NODE_OPTIONS (with --max-old-space-size)

0 Kudos