V14 is causing issues with the licenseKey set up on ExcelIO package

Posted by: davide.vago on 22 November 2020, 11:45 pm EST

    • Post Options:
    • Link

    Posted 22 November 2020, 11:45 pm EST

    Good morning/afternoon

    I’m reaching you out as after the update from Sjs version 13 to 14 we are experiencing an issue with the ExcelIO library within our codebase.

    It appears that the previous implementation:

    
    import spreadExcel from '@grapecity/spread-excelio'
    
    spreadExcel.LicenseKey = process.env.SPREADJS_KEY
    
    
    

    throws an error, in fact, the LicenseKey can’t be set because the spreadExcel object is not defined. Something changed on the export default of your @grapecity/spread-excelio package.

    Could you please advise how to resolve the issue?

    Looking forward to hearing from you

  • Posted 23 November 2020, 8:08 pm EST

    Hi Davide,

    Please replace the import code by following the code snippet and let us know if you face any issue persists.

    
    import * as spreadExcel from "@grapecity/spread-excelio";
    
    spreadExcel.LicenseKey = process.env.SPREADJS_KEY;
    
    

    Regards

    Avinash

  • Posted 23 November 2020, 9:27 pm EST

    Thanks for your reply.

    Unfortunately the import using * as throws an error:

    130:5  error  The members of 'spreadExcel' are read-only  no-import-assign
    
  • Posted 24 November 2020, 7:49 pm EST - Updated 3 October 2022, 12:40 am EST

    Hi Davide,

    We are unable to replicate the issue at our end. Importing via * as syntax solves the issue at our end Please refer to the following Gif of our observations and if the issue persists please share a small sample that replicates the issue so that we could investigate it further and assist you accordingly.

    Regards

    Avinash

  • Posted 3 December 2020, 2:40 am EST

    Hi Avinash,

    I had to disable the linter with the following string:

    /*eslint no-import-assign: "off"*/
    
    

    The solution you are showcasing doesn’t have the same linter configuration we use.

    
    'eslint:recommended', 
    'prettier/vue',
    
    

    Here the linter info:

    https://eslint.org/docs/rules/no-import-assign

    Please flag it to the developers for the next releases because this seems to be a regression, maybe a function like setLicenseKey(myKey) would be helpful.

    Thanks for your support as usual

  • Posted 7 December 2020, 5:02 pm EST

    Hi Dave,

    Could you please share a small sample or some steps that replicates the issue? so that we could investigate it further and assist you accordingly regards.

    Regards

    Avinash

  • Posted 16 August 2021, 12:25 am EST

    @davide.vago

    Not sure if you still have the problem, I had the same issue as yours (I’m using https://vitejs.dev/ as a bundler and it only fails when building for production), since from what I have researched there was no “official” solution, I had to add the License like this:

    
    import * as ExcelIO from '@grapecity/spread-excelio';
    if (ExcelIO.default) {
      ExcelIO.default.LicenseKey = license;
    } else {
      ExcelIO.LicenseKey = license;
    }
    
    

    Felipe V.

  • Posted 16 August 2021, 12:33 am EST

    Thanks @felipe, I had to implement the way Avinash suggested adding the

    /eslint no-import-assign: “off”/ just above the import

    I believe your solution is cleaner

    Thanks for sharing.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels