微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在Bamboo中进行角度构建:无法解析“ xlsx”

如何解决无法在Bamboo中进行角度构建:无法解析“ xlsx”

我已经安装了xlsx模块并导入了用于在角度下载Excel。

enter image description here

 private exportToExcel = (tableId):void=>{
            /*name of the excel-file which will be downloaded. */ 
            let fileName= 'PendingTransactionDueForrenewal.xlsx';    

            /* table id is passed over here */   
            let element = document.getElementById(tableId); 
            const ws: XLSX.WorkSheet =XLSX.utils.table_to_sheet(element);

            /* generate workbook and add the worksheet */
            const wb: XLSX.WorkBook = XLSX.utils.book_new();
            XLSX.utils.book_append_sheet(wb,ws,'PendingTransactionDueForrenewal');
            
            /* Set the column width */
            var wscols = [
                {wch:50},{wch:50},{wch:100}
                ];
                ws['!cols'] = wscols;
              wb.Sheets["PendingTransactionDueForrenewal"] = ws;
            
            /* save to file */
            XLSX.writeFile(wb,fileName);
    }

我可以运行下载带有数据的excel表格。但是,在将代码签入GIT之后,Bamboo将为功能分支进行自动构建,并因以下错误而使构建失败:

未找到模块:错误:无法解析'E:\ bamboo \ agent_1 \ xml-data \ build-dir \ EP2-EP2UI566-BUILDJOB \ app \ src \ app \ core \ module \ product \中的'xlsx' \

后来为了解决此问题,我使用以下代码

webpack.common.js:

'xlsx.shared.js': [      
  'node_modules/xlsx/dist/xlsx.js',],

index.html:

<script rel="preload" src="./xlsx.shared.js" as="script"></script>

仍然没有解决的人可以为此解决方案。

enviornment.ts:

enter image description here

config.json:

enter image description here

竹节错误

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。