1

Got error when saving / deploying the code to the Org. The error message:

Source: data value too large: 
import { LightningElement, track, api, wire } from 'lwc'
import getAllApprovedQuotes from "@salesforce/apex/{!ID:@@@sfdc=01p8A000003qsBQ=sfdc@@@}.getAllApprovedQuotes"
import getSaveFilters from "@salesforce/apex/{!ID:@@@sfdc=01p8A000003qsBQ=sfdc@@@}.getSaveFilters"
import getSavedFilterData from "@salesforce/apex/{!ID:@@@sfdc=01p8A000003qsBQ=sfdc@@@}.getSavedFilterData"
import getQuotesWithFilter from "@salesforce/apex/{!ID:@@@sfdc=01p8A0000056tf7=sfdc@@@}.getQuotesWithFilter"
import getQuotesApproved from "@salesforce/apex/{!ID:@@@sfdc=01p8A000003qsBQ=sfdc@@@}.getQuotesApproved&"
import getQuotesSubmitForApproval from "@ (0:0)
3
  • How many lines of code you have in that component? Aug 25, 2020 at 12:33
  • more than 3000 lines Aug 25, 2020 at 12:36
  • Looks like you're trying to take in more information than you have allocated memory for. You will need to refactor your code to work in batches of information instead of the entire collection at once.
    – Tim Hunter
    Aug 25, 2020 at 13:11

1 Answer 1

4

Each source file is limited to 131kb (2^17 characters). You will need to make smaller components/files in order to deploy your component. Components should be small and reusable. Entire applications should not be coded into a single component.

7
  • usually const = []; declaration consume more characters any ways to break the const declaration in seperate components or files? Aug 25, 2020 at 16:24
  • @Nirmal Include the structure in a secondary JS file, then import it: import FIELDLIST from './fieldlist.js'; const FIELDS = FIELDLIST; should work.
    – sfdcfox
    Aug 25, 2020 at 17:09
  • Thanks for the help , Temporarily i removed all unwanted code and comments and found some characters left . I managed to fix this. How to invoke elements inside FIELDLIST which is coming from another file. this keyword doesnt help. Sorry I am new to LWC. Aug 25, 2020 at 22:17
  • thanks @sfdcfox, is there any documentation about this? and can this limitation be raised?
    – Rival
    Jan 11, 2021 at 7:46
  • 1
    @Rival You can indeed have multiple js files in a component package and import the methods via normal import statements. I'm actually designing some components right now that have that design, it works well.
    – sfdcfox
    Jan 12, 2021 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .