Sheetjs: Use minified version on Angular 5?

Created on 9 May 2018  路  4Comments  路  Source: SheetJS/sheetjs

Is there a correct way to use minified XLSX on an Angular 5 project?

Currently I'm using it as:
import * as XLSX from 'xlsx';

Using this import like:
const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
And
const workbook: XLSX.WorkBook = XLSX.utils.book_new();

It works just fine, but produces a very large bundle object inside my build:
image

I want to know if it's possible to use the .min files, to help reduce the bundle size. And if so, how to import and use it properly?

Most helpful comment

The minified version itself is about that size. There is a smaller xlsx.core.min.js file ~460KB (~145KB gzipped) that omits the cpexcel blob.

To omit the cpexcel blob in the build without having to reference the separate file, you can suppress cpexcel.js in the webpack config, as shown in the webpack demo. If you are using the angular cli, you may need to eject.

All 4 comments

The minified version itself is about that size. There is a smaller xlsx.core.min.js file ~460KB (~145KB gzipped) that omits the cpexcel blob.

To omit the cpexcel blob in the build without having to reference the separate file, you can suppress cpexcel.js in the webpack config, as shown in the webpack demo. If you are using the angular cli, you may need to eject.

Hi,
How can we configure this for angular cli build?

How can we configure this for react?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamespan0 picture jamespan0  路  3Comments

DannyRyman picture DannyRyman  路  3Comments

jamesbillinger picture jamesbillinger  路  4Comments

gustavosimil picture gustavosimil  路  3Comments

Alex0007 picture Alex0007  路  3Comments