我将这个种子项目与 Angular 4 和 SystemJS ( angular-seed )一起使用
并想使用 SheetJS 导出 Excel 文件。我按照说明,可以很好地导入 xlsx,但是导出文件时它不断返回错误:
XLSX.utils.aoa_to_sheet is not a function
我已添加到 project.config.ts
...
{
name: 'xlsx',
// Path to the package's bundle
path: 'node_modules/xlsx/dist',
packageMeta: {
defaultExtension: 'js',
main: 'xlsx.core.min.js'
}
}
甚至修改seed.config.ts
meta: {
'xlsx': {
exports: 'XLSX' // <-- this is needed to tell SystemJS to expose XLSX
}
},
map: {
'fs': '', // <--|
'crypto': '', // <--| suppress native node modules
'stream': '', // <--|
},
但仍然无法让 SystemJS 理解正确导入 XLSX。
任何人之前都遇到过这个问题,可以建议我如何解决它。任何帮助表示赞赏。谢谢你。