I'm using this seed project with Angular 4 and SystemJS (angular-seed)
And want to use SheetJS to export Excel file. I follow the instruction, can import xlsx fine, but when export file it constantly return error:
XLSX.utils.aoa_to_sheet is not a function
I have added to the project.config.ts
...
{
name: 'xlsx',
// Path to the package's bundle
path: 'node_modules/xlsx/dist',
packageMeta: {
defaultExtension: 'js',
main: 'xlsx.core.min.js'
}
}
And even modify the seed.config.ts
meta: {
'xlsx': {
exports: 'XLSX' // <-- this is needed to tell SystemJS to expose XLSX
}
},
map: {
'fs': '', // <--|
'crypto': '', // <--| suppress native node modules
'stream': '', // <--|
},
But still cannot make the SystemJS understand to import XLSX correctly.
Anyone has faced this problem before can suggest me how to fix it. Any help is appreciated. Thank you.
I just had this issue (but in a react app) the “xlsx.core.min.js” won’t really work
I never used angular but I imagine a config like this could work
Also i would suggest to use “code splitting”, if available to your project, because this is a huge dependency